Bug 3883

Summary: Undesired pre-fill of fields due to
Product: Taglibs Reporter: chad lafontaine <clafonta>
Component: Input TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: CLOSED INVALID    
Severity: enhancement    
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: All   
OS: All   
URL: n/a

Description chad lafontaine 2001-09-28 17:33:08 UTC
Request 
--------
the ability to 'turn off' pre-filling of text field(s) (or more generally, 
ability to 'turn off' pre-filling for all Input Talib components)

Problem 
--------
the user enters a password in a textfield. If the password is invalid, and the 
user is returned to the JSP page, the password is automatically displayed. What 
if I wanted to turn it off? Even  if I define a default value, any matching 
value in the HttpRequest is picked up before hand. 
 
Lets look at a specific example, located in method 
org.apache.taglibs.input.Text#doStartTag() 

// CURRENT CODE 
/*
 * print out the value from the request if it's there, or
 * use the default value if it's not
 */
if (req.getParameter(name) != null)
    out.print("value=\"" 
        + Util.quote(req.getParameter(name)) + "\" ");
else if (dVal != null)
    out.print("value=\"" + Util.quote(dVal) + "\" ");
else
    out.print("value=\"\" ");

// POSSIBLE SOLUTION  
// with introduction of a boolean attribute e.g., 'prefill'
if (prefill && req.getParameter(name) != null)
    out.print("value=\"" 
        + Util.quote(req.getParameter(name)) + "\" ");
else if (prefill && dVal != null)
    out.print("value=\"" + Util.quote(dVal) + "\" ");
else
    out.print("value=\"\" ");
Comment 1 Shawn Bayern 2001-09-29 06:46:00 UTC
Input fields that do not need to be filled automatically should appear as 
straight HTML tags; auto-fill is the core function of the library.  
<input:password> is specifically not included since this functionality would be 
inappropriate for passwords.