craigmcc 01/02/23 10:23:56 Modified: src/doc struts-html.xml src/test/org/apache/struts/test TestBean.java Log: Document the cases in which an ActionForm.reset() method is required to reset individual property values: * <html:checkbox> * <html:multibox> * <html:select multiple="true"> Update the bean used in the test applications to reflect this. Submitted by: Martin Stiel <[EMAIL PROTECTED]> PR: Bugzilla #689 Revision Changes Path 1.16 +55 -18 jakarta-struts/src/doc/struts-html.xml Index: struts-html.xml =================================================================== RCS file: /home/cvs/jakarta-struts/src/doc/struts-html.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- struts-html.xml 2001/02/20 05:20:05 1.15 +++ struts-html.xml 2001/02/23 18:23:55 1.16 @@ -465,12 +465,18 @@ </summary> <tagclass>org.apache.struts.taglib.html.CheckboxTag</tagclass> <info> - <p> - Renders an HTML <input> element of type checkbox, populated - from the specified value or the specified property of the bean - associated with our current form. This tag is only valid when - nested inside a form tag body. - </p> + <p>Renders an HTML <input> element of type + <code>checkbox</code>, populated from the specified + value or the specified property of the bean associated + with our current form. This tag is only valid when + nested inside a form tag body.</p> + + <p><strong>WARNING</strong>: In order to correctly + recognize unchecked checkboxes, the + <code>ActionForm</code> bean associated with this form + must include a statement setting the corresponding + boolean property to <code>false</code> in the + <code>reset()</code> method.</p> </info> <attribute> @@ -2346,15 +2352,23 @@ </summary> <tagclass>org.apache.struts.taglib.html.MultiboxTag</tagclass> <info> - <p> - Renders an HTML <input> element of type checkbox, whose "checked" - status is initialized based on whether the specified value matches - one of the elements of the underlying property's array of current - values. This element is useful when you have large numbers of - checkboxes, and prefer to combine the values into a single - array-valued property instead of multiple boolean properties. - This tag is only valid when nested inside a form tag body. - </p> + <p>Renders an HTML <input> element of type + <code>checkbox</code>, whose "checked" status is + initialized based on whether the specified value + matches one of the elements of the underlying + property's array of current values. This element is + useful when you have large numbers of checkboxes, and + prefer to combine the values into a single + array-valued property instead of multiple boolean + properties. This tag is only valid when nested + inside a form tag body.</p> + + <p><strong>WARNING</strong>: In order to correctly + recognize cases where none of the associated checkboxes + are selected, the <code>ActionForm</code> bean + associated with this form must include a statement + setting the corresponding array to zero length in the + <code>reset()</code> method.</p> <p>The value to be returned to the server, if this checkbox is selected, must be defined by one of the following methods:</p> @@ -3487,9 +3501,32 @@ <tagclass>org.apache.struts.taglib.html.SelectTag</tagclass> <bodycontent>JSP</bodycontent> <info> - Custom tag that represents an HTML select element, associated with a - bean property specified by our attributes. This tag must be nested - inside a form tag. + <p>Renders an HTML <select> element, associated + with a bean property specified by our attributes. This + tag is only valid when nested inside a form tag body. + </p> + + <p>This tag operates in two modes, depending upon the + state of the <code>multiple</code> attribute, which + affects the data type of the associated property you + should use:</p> + <ul> + <li><em>multiple="true" IS NOT selected</em> - + The corresponding property should be a scalar + value of any supported data type.</li> + <li><em>multiple="true" IS selected</em> - + The corresponding property should be an array + of any supported data type.</li> + </ul> + + <p><strong>WARNING</strong>: In order to correctly + recognize cases where no selection at all is made, the + <code>ActionForm</code> bean associated with this form + must include a statement resetting the scalar property + to a default value (if <code>multiple</code> is not + set), or the array property to zero length (if + <code>multiple</code> is set) in the + <code>reset()</code> method.</p> </info> 1.7 +5 -4 jakarta-struts/src/test/org/apache/struts/test/TestBean.java Index: TestBean.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/test/org/apache/struts/test/TestBean.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestBean.java 2001/02/22 02:53:31 1.6 +++ TestBean.java 2001/02/23 18:23:56 1.7 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/test/TestBean.java,v 1.6 2001/02/22 02:53:31 craigmcc Exp $ - * $Revision: 1.6 $ - * $Date: 2001/02/22 02:53:31 $ + * $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/test/TestBean.java,v 1.7 2001/02/23 18:23:56 craigmcc Exp $ + * $Revision: 1.7 $ + * $Date: 2001/02/23 18:23:56 $ * * ==================================================================== * @@ -72,7 +72,7 @@ * General purpose test bean for Struts custom tag tests. * * @author Craig R. McClanahan - * @version $Revision: 1.6 $ $Date: 2001/02/22 02:53:31 $ + * @version $Revision: 1.7 $ $Date: 2001/02/23 18:23:56 $ */ public class TestBean extends ActionForm { @@ -314,6 +314,7 @@ booleanProperty = false; intMultibox = new int[0]; + multipleSelect = new String[0]; stringMultibox = new String[0]; if (nested != null) nested.reset(mapping, request);