【问题标题】:How to add extra html attribute in struts 1 html taglib?如何在 struts 1 html taglib 中添加额外的 html 属性?
【发布时间】:2013-09-14 09:25:58
【问题描述】:

如何在 struts 1 中将 autocomplete="off" 标准 html 属性添加到我的输入标签?

我的意见:

<html:text property="appUser.username" size="21" maxlength="50"/>

javascript 解决方案不仅仅适用于 CSS 或 struts 1 解决方案。

【问题讨论】:

标签: java css struts-1


【解决方案1】:

您可以添加自定义 tld 覆盖 struts html taglib。获取原始的 struts-html.tld,将其复制为标签文件夹中的 struts-html-autocomplete.tld。添加到form标签

<tag>
    <name>form</name>
     ...
    <attribute>
        <name>autocomplete</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    ....
</tag>

在 web.xml 中定义新的 tld:

<jsp-config>
  <taglib>
    <taglib-uri>html</taglib-uri>
    <taglib-location>/WEB-INF/tags/struts-html-autocomplete.tld</taglib-location>
  </taglib>
</jsp-config>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-10
    • 2021-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-18
    • 1970-01-01
    • 2015-04-06
    相关资源
    最近更新 更多