The password is automatically filled in despite the setting of redisplay = false in JSP (Struts)


So I have a web application on Tomcat, built on top of Struts 1.1. Here is a snippet of my JSP, it's a login.

<html:form action = "LoginAction" focus = "username">
   <tr><td align = "right">User name: </td> <td><html:text property = "username"/> </td></tr>
   <tr><td align = "right">Password: </td><td><html:password property = "password" redisplay = "false"/></td></tr>

Snippet from struts-html-1.1.tld:


Resulting HTML: Having trouble getting this to post as code but the relevant part is an input tag of type 'password' with no reference to redisplay, autocomplete, etc. It is my understanding that the redisplay element should be passed through Struts to appear in the HTML.

What you are looking for is the HTML autocomplete attribute that exists on input type="text", input type="password", textarea, form elements, etc. This attribute, in my humble knowledge, wasn't added in Struts 1.x libraries.

You will have to create a custom tag library that includes autocomplete that will work as follows:

<html:password property="password" autocomplete="off" />

There are various tutorials and blogs on the web that shows you how this can be achieved.

Good luck!