I'm using struts2 tags and want to put a placeholder in a <s:textfield>
tag like this:
<s:set name="email" value="getText('email')" />
...
<s:form action="Login">
<s:textfield key="email" theme="simple" placeholder="%{email}"
cssClass="span3"/>
...
</s:form>
email
is defined in global.properties
as "Correo electrónico" .
My problem is that when I see the jsp page, instead of seeing the value of email
I see %{email}
.
I read that it was a bug of Struts2 solved in version 2.3.1 here: https://issues.apache.org/jira/browse/WW-3644, but I'm using Struts2 2.3.4 and I keep having the same problem.
Anyone knows any solution to this problem or any other way for putting the placeholder in the textfield?
I had the same problem and I solved it like this:
<s:textfield name="user.email" placeholder="%{getText('settings.email')}" />
I needed up update both my Struts 2 and OGNL jars. My OGNL jar is ognl-3.0.5.jar
.
You should be using the #
prefix for variables created in the stack namespace but not pushed:
<s:textfield placeholder="%{#email}" ... etc ... />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With