On Sat, 2006-12-09 at 13:29 -0500, Rick Schumeyer wrote:
> I have jsp containing a form to add employees.  This submits to an 
> action that adds the new employee to the database, and then forwards 
> back to the add employee page so that more employees can be added.  
> Currently, when I get back to the jsp the ActionForm still contains the 
> original data, but at this point I want a blank action form.
> 
> If I am using an ActionForm (as opposed to a DynaActionForm), what is 
> the best way to clear the form?
> *  I can manually clear all the fields in the action before calling 
> findForward
> * Should I override the ActionForm reset method (and call reset before 
> findForward) ?
> * Should I use a DynaActionForm instead?  (Would that provide any advantage)
> * Is there some other obvious solution that I'm missing?
> 
> BTW, this is struts 1.3.5.  The action configuration declares request scope.

Rick,

If you perform a redirect instead of a forward from the action, the new
page will have a new form, because the data will not carry over (because
you are using request scope).

As a bonus, if the user reloads the page, they will not be resubmitting
the form post that adds an employee.

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to