gpt4 book ai didi

java - 如何在 struts 1 html 标签库中添加额外的 html 属性?

转载 作者:搜寻专家 更新时间:2023-11-01 03:53:09 25 4
gpt4 key购买 nike

如何将 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com