struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moore, Scott R." <MOOR...@SEC.GOV>
Subject RE: question regarding DynaActionForm.reset()
Date Mon, 31 Mar 2003 21:15:49 GMT

A coworker pointed out a workaround for explicitly resetting a
DynaValidatorForm in my Action class, so I thought I'd share it.  In the
Action class that handles an ActionForm (which is really a DynaValidatorForm
configured in struts-config.xml):

  // "form" is the ActionForm object passed in to the method
  DynaValidatorForm dynaForm = (DynaValidatorForm) form;

This is helpful in situations like mine, where:
 - The user enters some data in a form, then gets some errors reported by
the Validator framework.
 - The user is shown a form with error messages, and each form field is
pre-populated with data they just submitted so they can quickly correct
their errors
 - The user goes elsewhere in your web app, then returns to the form
mentioned above, and you do NOT want to pre-populate the form fields with
the data they entered before.

HTH.  Thanks Wendy and Donald for your replies earlier.


-----Original Message-----
From: Wendy Smoak []
Sent: Monday, March 31, 2003 3:45 PM
To: 'Struts Users Mailing List'
Subject: RE: question regarding DynaActionForm.reset()

Scott wrote:
> 2) Does DynaValidatorForm.reset() also do nothing?  According to the
> Javadoc, it should "Reset all properties to their default values",
> when I run the following code snippet in my Action class (the variable
> "form" is the ActionForm object that is given to the method):

Anecdotally, yes, DynaValidatorForm.reset() does nothing.  
You have to implement it in your own form if you want it to do something.

   public void reset( ActionMapping mapping, HttpServletRequest request )

It's documented on DynaValidatorForm's parent, DynaActionForm:

Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message