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=\"\" ");
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.