How to add additional html attribute to struts 1 html taglib?

How to add autocomplete="off" standard html attribute to my input tag in struts 1?

my input:

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

The javascript solution is not suitable only for CSS or struts 1 solution.

+4
source share
1 answer

You can add custom tld override struts html taglib. Get the original struts-html.tld file, copy it as struts-html-autocomplete.tld into the tag folder. Add to form tag:

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

In web.xml, define the new tld:

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

Source: https://habr.com/ru/post/1502164/


All Articles