如何将 autocomplete="off"
标准 html 属性添加到我在 struts 1 中的输入标签?
我的输入:
<html:text property="appUser.username" size="21" maxlength="50"/>
javascript 解决方案不适用于 CSS 或 struts 1 解决方案。
最佳答案
您可以添加一个自定义的顶级域名来覆盖 struts html 标签库。获取原始的 struts-html.tld,将其作为 struts-html-autocomplete.tld 复制到您的标签文件夹中。添加到表单标签:
<tag>
<name>form</name>
...
<attribute>
<name>autocomplete</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
....
</tag>
在 web.xml 中定义新的顶级域名:
<jsp-config>
<taglib>
<taglib-uri>html</taglib-uri>
<taglib-location>/WEB-INF/tags/struts-html-autocomplete.tld</taglib-location>
</taglib>
</jsp-config>
关于java - 如何在 struts 1 html 标签库中添加额外的 html 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18800280/