TheByeByeMan
TheByeByeMan

Reputation: 1424

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 :

<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. My question Is : How Can I internationalize the "Something" String inside of the title attribute in my form:input Tag ?

Upvotes: 3

Views: 3318

Answers (1)

Roman C
Roman C

Reputation: 1

You can use JSTL tags

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

Upvotes: 3

Related Questions