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

发布于 2025-01-07 07:54:06 字数 122 浏览 3 评论 0原文

我在 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

誰認得朕 2025-01-14 07:54:06

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

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

  • 自己编辑源代码,并向标记添加占位符属性。
  • 避免使用标签,回到基本的 HTML + JSTL + EL :

    
    

Struts 1 is dead. It hasn't had a release since 2008. I would really think about migrating to a more modern framework.

If you're stuck with Struts 1, you could

  • 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" />
    
╄→承喏 2025-01-14 07:54:06

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

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

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

In case this might be helpful to others:

If you have a JavaBean (with getters and setters) you could use basic html and the bean:write struts tag.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文