craigmcc 2002/07/06 16:36:30
Modified: doc/userGuide struts-html.xml
src/share/org/apache/struts/taglib/html ResetTag.java
SubmitTag.java
web/example logon.jsp
Log:
Make <html:submit> no longer generate a "name" attribute unless a "property"
element on <html:submit> is explicitly specified. This avoids Javascript
problems with the default name that as being created ("submit").
For consistency, make <html:reset> operate in the same manner.
Based on a patch submitted by Ben Tomasini -- thanks!
PR: Bugzilla #9594
Submitted by: Ben Tomasini <btomasini at neteverything.com>
Revision Changes Path
1.13 +9 -0 jakarta-struts/doc/userGuide/struts-html.xml
Index: struts-html.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/doc/userGuide/struts-html.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- struts-html.xml 23 Jun 2002 22:44:42 -0000 1.12
+++ struts-html.xml 6 Jul 2002 23:36:29 -0000 1.13
@@ -4932,6 +4932,15 @@
</attribute>
<attribute>
+ <name>property</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <info>
+ Name of the input field that will be generated.
+ </info>
+ </attribute>
+
+ <attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
1.6 +17 -14
jakarta-struts/src/share/org/apache/struts/taglib/html/ResetTag.java
Index: ResetTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ResetTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ResetTag.java 11 Dec 2001 17:54:28 -0000 1.5
+++ ResetTag.java 6 Jul 2002 23:36:29 -0000 1.6
@@ -95,7 +95,7 @@
/**
* The name of the generated input field.
*/
- protected String name = "reset";
+ protected String property = null;
/**
@@ -116,9 +116,9 @@
/**
* Return the field name.
*/
- public String getName() {
+ public String getProperty() {
- return (this.name);
+ return (this.property);
}
@@ -126,11 +126,11 @@
/**
* Set the field name.
*
- * @param name The field name
+ * @param property The field name
*/
- public void setName(String name) {
+ public void setProperty(String property) {
- this.name = name;
+ this.property = property;
}
@@ -208,9 +208,12 @@
// Generate an HTML element
StringBuffer results = new StringBuffer();
- results.append("<input type=\"reset\" name=\"");
- results.append(name);
- results.append("\"");
+ results.append("<input type=\"reset\"");
+ if (property != null) {
+ results.append(" name=\"");
+ results.append(property);
+ results.append("\"");
+ }
if (accesskey != null) {
results.append(" accesskey=\"");
results.append(accesskey);
@@ -243,7 +246,7 @@
public void release() {
super.release();
- name = "reset";
+ property = null;
text = null;
value = null;
1.9 +12 -8
jakarta-struts/src/share/org/apache/struts/taglib/html/SubmitTag.java
Index: SubmitTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/SubmitTag.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SubmitTag.java 25 Jun 2002 00:45:41 -0000 1.8
+++ SubmitTag.java 6 Jul 2002 23:36:29 -0000 1.9
@@ -96,7 +96,7 @@
/**
* The name of the generated input field.
*/
- protected String property = "submit";
+ protected String property = null;
/**
@@ -211,8 +211,12 @@
// Generate an HTML element
StringBuffer results = new StringBuffer();
- results.append("<input type=\"submit\" name=\"");
- results.append(property);
+ results.append("<input type=\"submit\"");
+ if (property != null) {
+ results.append(" name=\"");
+ results.append(property);
+ results.append("\"");
+ }
// * @since Struts 1.1
if( indexed )
prepareIndex( results, null );
@@ -249,7 +253,7 @@
public void release() {
super.release();
- property = "submit";
+ property = null;
text = null;
value = null;
1.19 +1 -1 jakarta-struts/web/example/logon.jsp
Index: logon.jsp
===================================================================
RCS file: /home/cvs/jakarta-struts/web/example/logon.jsp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- logon.jsp 30 Nov 2001 02:12:00 -0000 1.18
+++ logon.jsp 6 Jul 2002 23:36:30 -0000 1.19
@@ -35,7 +35,7 @@
<tr>
<td align="right">
- <html:submit property="submit" value="Submit"/>
+ <html:submit value="Submit"/>
</td>
<td align="left">
<html:reset/>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>