简体   繁体   English

在表单内部使用spring:message标签:在Spring MVC中输入标签

[英]Using spring:message tag inside of form:input tag in Spring MVC

I want to Internationalize the content of an attribute in my Spring MVC app, the snippet code from my JSP file : 我想在我的Spring MVC应用程序中对属性的内容进行国际化,这是我的JSP文件中的代码段代码:

<form:input type="text" path="someAttribute" title="something"/>

And it's working fine, But When I want to Internationalize like this : 它工作正常,但当我想这样国际化时:

<form:input type="text" path="someAttribute" 
title="<spring:message code="label.something"/>"/>

it seems wrong, since it throws a org.apache.jasper.JasperException Exception. 它似乎错了,因为它抛出了一个org.apache.jasper.JasperException异常。 My question Is : How Can I internationalize the "Something" String inside of the title attribute in my form:input Tag ? 我的问题是:我如何将我的form:input title属性中的“Something”字符串国际化form:input标签?

You can use JSTL tags 您可以使用JSTL标记

<c:set var="title"><spring:message code="label.something"/></c:set>
<form:input type="text" path="someAttribute" title="${title}"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM