Struts html:text标签内的HTML5占位符

时间:2012-02-18 01:17:53

标签: html5 struts-1

我在Web应用程序中使用Struts 1.3.10,我希望我的textfields有一个占位符。不幸的是,当前的Struts taglib无法识别这个属性,如果可能的话我想避免使用javascript。你知道任何解决方案吗?

2 个答案:

答案 0 :(得分:2)

Struts 1已经死了。它自2008年以来一直没有发布。我真的会考虑迁移到更现代的框架。

如果你坚持使用Struts 1,你可以

  • 自行编辑源代码,并为代码添加占位符属性。
  • 避免使用标记,然后返回基本HTML + JSTL + EL:

    <input type="text" name="foo" value="<c:out value='${myForm.foo}' />" 
           placeholder="Enter foo here" />
    

答案 1 :(得分:0)

如果这可能对其他人有帮助:

如果你有一个JavaBean(带有getter和setter),你可以使用基本的html和bean:write struts标签。

&#13;
&#13;
<input type="text" name="foo" placeholder="Enter foo here"value="<bean:write name="myFormBean" property="foo" />"> 
&#13;
&#13;
&#13;