Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 441
TheByeByeMan Avatar asked Feb 02 '26 21:02

TheByeByeMan


1 Answers

You can use JSTL tags

<c:set var="title"><spring:message code="label.something"/></c:set>
<form:input type="text" path="someAttribute" title="${title}"/>
like image 138
Roman C Avatar answered Feb 04 '26 15:02

Roman C



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!