Author: niallp Date: Sat Aug 9 10:39:47 2008 New Revision: 684304 URL: http://svn.apache.org/viewvc?rev=684304&view=rev Log: STR-2810 Add non-standard autocomplete attribute (only renders if not in XHTML mode), but leave autocomplete attributes in TLD commented out so that it is not enabled by default - thanks to Mark Lowe
Modified: struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseFieldTag.java struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseInputTag.java struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/FormTag.java struts/struts1/trunk/taglib/src/main/resources/META-INF/tld/struts-html.tld Modified: struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseFieldTag.java URL: http://svn.apache.org/viewvc/struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseFieldTag.java?rev=684304&r1=684303&r2=684304&view=diff ============================================================================== --- struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseFieldTag.java (original) +++ struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseFieldTag.java Sat Aug 9 10:39:47 2008 @@ -102,6 +102,9 @@ prepareValue(results); results.append(this.prepareEventHandlers()); results.append(this.prepareStyles()); + if (!isXhtml()) { + prepareAttribute(results, "autocomplete", getAutocomplete()); + } prepareOtherAttributes(results); results.append(this.getElementClose()); Modified: struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseInputTag.java URL: http://svn.apache.org/viewvc/struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseInputTag.java?rev=684304&r1=684303&r2=684304&view=diff ============================================================================== --- struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseInputTag.java (original) +++ struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/BaseInputTag.java Sat Aug 9 10:39:47 2008 @@ -41,6 +41,11 @@ // ----------------------------------------------------- Instance Variables /** + * Autocomplete non standard attribute + */ + protected String autocomplete = null; + + /** * The number of character columns for this field, or negative for no * limit. */ @@ -73,6 +78,21 @@ protected String name = Constants.BEAN_KEY; // ------------------------------------------------------------- Properties + + /** + * Return autocomplete + */ + public String getAutocomplete() { + return autocomplete; + } + + /** + * Activate/disactivate autocompletion (on/off) + */ + public void setAutocomplete(String autocomplete) { + this.autocomplete = autocomplete; + } + public String getName() { return (this.name); } @@ -228,6 +248,7 @@ */ public void release() { super.release(); + autocomplete = null; name = Constants.BEAN_KEY; cols = null; maxlength = null; Modified: struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/FormTag.java URL: http://svn.apache.org/viewvc/struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/FormTag.java?rev=684304&r1=684303&r2=684304&view=diff ============================================================================== --- struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/FormTag.java (original) +++ struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/FormTag.java Sat Aug 9 10:39:47 2008 @@ -68,6 +68,11 @@ protected String action = null; /** + * Autocomplete non standard attribute + */ + protected String autocomplete = null; + + /** * A postback action URL to which this form should be submitted, if any. */ private String postbackAction = null; @@ -229,6 +234,20 @@ } /** + * Return autocomplete + */ + public String getAutocomplete() { + return autocomplete; + } + + /** + * Activate/disactivate autocompletion (on/off) + */ + public void setAutocomplete(String autocomplete) { + this.autocomplete = autocomplete; + } + + /** * Return the content encoding used when submitting this form. */ public String getEnctype() { @@ -548,6 +567,9 @@ renderAttribute(results, "onsubmit", getOnsubmit()); renderAttribute(results, "style", getStyle()); renderAttribute(results, "target", getTarget()); + if (!isXhtml()) { + renderAttribute(results, "autocomplete", getAutocomplete()); + } // Hook for additional attributes renderOtherAttributes(results); @@ -757,6 +779,7 @@ public void release() { super.release(); action = null; + autocomplete = null; moduleConfig = null; enctype = null; dir = null; Modified: struts/struts1/trunk/taglib/src/main/resources/META-INF/tld/struts-html.tld URL: http://svn.apache.org/viewvc/struts/struts1/trunk/taglib/src/main/resources/META-INF/tld/struts-html.tld?rev=684304&r1=684303&r2=684304&view=diff ============================================================================== --- struts/struts1/trunk/taglib/src/main/resources/META-INF/tld/struts-html.tld (original) +++ struts/struts1/trunk/taglib/src/main/resources/META-INF/tld/struts-html.tld Sat Aug 9 10:39:47 2008 @@ -1941,6 +1941,14 @@ ]]> </description> </attribute> + <!-- autocomplete is a non-standard and not supported, uncomment to enable --> + <!-- + <attribute> + <name>autocomplete</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + --> <attribute> <name>dir</name> <required>false</required> @@ -6436,6 +6444,14 @@ ]]> </description> </attribute> + <!-- autocomplete is a non-standard and not supported, uncomment to enable --> + <!-- + <attribute> + <name>autocomplete</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + --> <attribute> <name>bundle</name> <required>false</required> @@ -8757,6 +8773,14 @@ ]]> </description> </attribute> + <!-- autocomplete is a non-standard and not supported, uncomment to enable --> + <!-- + <attribute> + <name>autocomplete</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + --> <attribute> <name>bundle</name> <required>false</required>