STORING
USER INPUT
Storing user
input should be done after
all the validations (client-side
and server-side), so in an
Action. StrutsWizard provides
a Action class named WizardAction.
Each Action class of your
wizard should extends WizardAction.
This class has only one method
which signature is below :
protected
void processForm(HttpServletRequest
request, ActionForm form)
This method
should be called usually at
the end of your Action, like
this (note that nothing prevent
you form calling it earlier
in the method) :
public ActionForward
execute(....)
{
.......
super.processForm(request,
form);
return mapping.findForward(....);
}
The first
parameter is the current request
object. With this parameter,
the API can see form which
action the call is done, so
the API can know what is the
input page of the form, and
what is the form configuration.
The second
parameter is the form itself.
It can be either basic ActionForm,
or DynaActionForm. As the
API stores input as maps,
if the form is dynamic, the
DynaActionForm.getMap() is
called to get the input and
if the form is an ActionForm,
then the Commons BeanUtils
API is used to get all the
input.
|