如何将占位符放在struts2 textfield标记中? [英] How can I put a placeholder in a struts2 textfield tag?

查看:140
本文介绍了如何将占位符放在struts2 textfield标记中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用struts2标签,并希望将占位符放在< s:textfield> 标记中,如下所示:

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>

电子邮件在<$ c $中定义c> global.properties asCorreoelectrónico。

email is defined in global.properties as "Correo electrónico" .

我的问题是当我看到jsp页面时,而不是看到的值电子邮件我看到%{email}

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

I请注意这是在2.3.1版本中解决的Struts2的错误: https:// issues .apache.org / jira / browse / WW-3644 ,但我使用Struts2 2.3.4并且我一直遇到同样的问题。

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')}" />

我需要更新我的Struts 2 OGNL罐子。我的OGNL jar是 ognl-3.0.5.jar

I needed up update both my Struts 2 and OGNL jars. My OGNL jar is ognl-3.0.5.jar.

这篇关于如何将占位符放在struts2 textfield标记中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆