Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use <spring:message> inside an attribute of <form:input>?

I have JSP code like:

<div class="formRow">     <form:input id="email_email" name="email_email" title="XXXXX"/>" path="email" cssClass="input required email" />     <form:errors path="email" cssClass="error" /> </div> 

I want to set the title attribute with some tooltip text, supporting i18n. How would I do this?

I am looking to do something like this:

<div class="formRow">     <form:input id="email_email" name="email_email" title="<spring:message code="tooltip.text" />"/>" path="email" cssClass="input required email" />     <form:errors path="email" cssClass="error" /> </div> 
like image 922
tomasz-mer Avatar asked Mar 11 '11 14:03

tomasz-mer


2 Answers

<spring:message code="tooltip.text" var="variable1"/> <form:input id="email_email" name="email_email" title="${variable1}" path="email"                        cssClass="input required email" /> 

You can't use a tag inside an attribute: But you can use the above. It works fine.

like image 59
chand priyankara Avatar answered Sep 19 '22 20:09

chand priyankara


You can't use a tag inside a tag, simply. You can do something like this,

<spring:message code="tooltip.text" var="i18nTooltip"/>  <form:input id="email_email" name="email_email" title="${i18nTooltip}" path="email"                        cssClass="input required email" /> 

P.S. Better use ${i18nTooltip}, instead of, i18nTooltip, to avoid confusion.

like image 45
Adeel Ansari Avatar answered Sep 21 '22 20:09

Adeel Ansari