How can I put a placeholder in a textfield struts2 tag?

I am using struts2 tags and want to put the placeholder in the <s:textfield> as follows:

 <s:set name="email" value="getText('email')" /> ... <s:form action="Login"> <s:textfield key="email" theme="simple" placeholder="%{email}" cssClass="span3"/> ... </s:form> 

email defined in global.properties as "Correo electrรณnico".

My problem is that when I see the jsp page, instead of seeing the email value, I see %{email} .

I read that it was a Struts2 error resolved in version 2.3.1 here: https://issues.apache.org/jira/browse/WW-3644 , but I am using Struts2 2.3.4 and I have the same problem.

Does anyone know of any solution to this problem, or in any other way put a placeholder in a text box?

+4
source share
2 answers

I had the same problem and solved it as follows:

 <s:textfield name="user.email" placeholder="%{getText('settings.email')}" /> 

I needed to upgrade both the Struts 2 and OGNL drums. My banner is OGNL ognl-3.0.5.jar .

+15
source

You must use the # prefix for variables created in the stack namespace but not pressed:

 <s:textfield placeholder="%{#email}" ... etc ... /> 
+2
source

All Articles