Details
Description
Handling reset() for certain fields in dyna forms would help with the
requirements of the <html:checkbox> tag.
There are two approaches I've thought of so far.
1) Simply reset any boolean fields to false inside reset(). This could cause
backward-compatibility issues if anyone out there is using boolean fields in
action forms for anything other than checkboxes.
2) Allow the user to configure both an initial value and a reset flag. This
could be something like:
<form-bean
name="MyForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="firstName"
type="java.lang.String" />
<form-property
name="lastName"
type="java.lang.String" />
<form-property
name="someFlag"
type="java.lang.String"
initial="false"
reset="true"/>
</form-bean>
Inside reset(), any property whose "reset" flag is set would be reset to its
initial value.
This would require both a DTD change, and a way for the DynaActionForm to know
what form name it is configured for. For this, FormBeanConfig's
createActionForm() can be modified to pass along the name onto the
DynaActionForm it creates.