问题描述
我在Web应用程序中使用Struts 1.3.10,并且希望我的文本字段具有占位符.不幸的是,当前的Struts taglib无法识别此属性,如果可能的话,我想避免使用javascript.您知道对此有什么解决方案吗?
I'm using Struts 1.3.10 in a web application, and I want my textfields to have a placeholder. Unfortunately, the current Struts taglib doesn't recognize this attribute, and I would like to avoid using javascript for this if possible. Do you know any solution for this?
推荐答案
Struts 1已死.自2008年以来,它还没有发布过.我真的会考虑迁移到更现代的框架.
Struts 1 is dead. It hasn't had a release since 2008. I would really think about migrating to a more modern framework.
如果您坚持使用Struts 1,可以
If you're stuck with Struts 1, you could
- 自己编辑源,然后在标签中添加一个占位符属性.
-
避免使用标记,而是返回基本的HTML + JSTL + EL:
- edit the sources yourself, and add a placeholder attribute to the tag.
avoid using the tag, and go back to basic HTML + JSTL + EL :
<input type="text" name="foo" value="<c:out value='${myForm.foo}' />"
placeholder="Enter foo here" />
这篇关于Struts html:text标记内的HTML5占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!