【问题标题】:How to put <spring:message code="code" /> inside a HTML attribute如何将 <spring:message code="code" /> 放入 HTML 属性中
【发布时间】:2016-10-21 20:21:00
【问题描述】:

我有一个使用 Spring 表单标签 制作的表单,并带有验证字段的 Bootstrap。 我必须将 spring:message> 标签放在 Bootstrap 的属性 data-minlength-error 内。像这样的:

data-minlength-error="<spring:message code="code"/>"

当然不行,因为嵌套了"

我尝试使用 ' 和 \ 编辑该代码,但没有找到正确的方法。

如果我这样做:data-minlength-error='&lt;spring:message code="code" /&gt;', Spring 在属性 data-minlength-error

内显示文本

【问题讨论】:

    标签: twitter-bootstrap spring-mvc


    【解决方案1】:

    可能不能用作属性标签。 请看this答案:

    这可能是一个解决方案:

    <spring:message code="your.code" var="variable_ref"/>
    <input data-minlength-error="${variable_ref}" type="text"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-14
      • 2020-11-22
      • 1970-01-01
      • 2013-02-17
      • 2022-12-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多