I am using the validation framework with Struts 1.1.When validation fails, the entire form is reset.
After much time scouring the net, I have gathered:
- When a new request is received, the form object is created if it does not exist in the current scope (request or session).
- Reset is called()
- Form values are populated from the bean properties.
- Validation starts if enabled
- If validation fails, ActionErrors are returned and the request is directed to the URI given by the input attribute of the action tag in my struts-config.xml.
That's where I have the problem. If validation fails, and I set the input param to the same page, reset() gets called again but it does not use the bean values from when the form is initially loaded. So the user has to re-enter everything.
My action mapping class for this action looks like this:
<action
path="/edit/componentRelease"
type="org.twdata.struts.SpringAction"
name="edit/componentRelease"
scope="request"
input="/WEB-INF/jsp/edit/editComponentRelease.jsp"
parameter="edit/componentRelease"
validate="true"
>
<forward
name="edit/componentRelease"
path="/WEB-INF/jsp/edit/editComponentRelease.jsp"
redirect="false"
/>
</action>
The form used to display the bean starts with:
<html:form method="post" name="componentReleaseEditor" type="com.mx.releasemgr.forms.ComponentReleaseEditorForm" action="/edit/componentRelease">
reset(), the method used to reset form values? - Dave Newton