Thanks you all for responding. It's much clear now.
I have created a DynaValidatorForm in strutsconfig.xml which has about 20
form properties for my jsp. I can see the components I need in my jsp.
This form is session scoped which has radio's and checkboxes.
So, I might have to reset the checkboxes now.
Do, I have no other choice but to create a formbean Class with all the
setter's and getter's and then add reset method too for it.
or is there an easier way to do this using DynaValidatorForm?
Thanks.
From: Andre Van Klaveren <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
To: Struts Users Mailing List <user@struts.apache.org>
Subject: Re: reset method in ActionForm
Date: Tue, 3 Jan 2006 12:49:55 -0600
Q: When exactly this method has to be used and when does this get called?
A: The reset method is called for each new request, for both request
and session scoped ActionForms, before the ActionForm is populated
from the request. Here's the sequence of events:
1. Request received by controller.
2. Create or recycle ActionForm (create request-scoped, recycle
session-scoped)
3. Call reset() method on ActionForm.
4. Store ActionForm in scope as defined in stuts-config.xml
5. Populate ActionForm from request.
6. Validate the ActionForm if defined in struts-config.xml.
Assuming no validation errors:
7a. Call execute() method of the Action passing ActionForm
With validation errors:
7b. Go back to input with ActionForm in proper scope.
Q: Why do the checkboxes have to be reset?
A: The reset() method was originally designed to reset boolean
variables that represent checkbox values in the HTML form. When an
HTML form contains checkboxes, only the values for the checkboxes that
are chedked are sent in the request (see HTTP spec). The reset()
method was designed to reset the boolean properties in the ActionForm
that represent checkboxes to false. This is necessary because false
values aren't sent in the request, only true ones. If you have a
session-scoped ActionForm, the boolean values for the checkboxes could
be set to true from a previous request. Without resetting them they
would always stay true.
With a request-scoped ActionForm you don't have to implement the reset
method unless you need your ActionForm properties to default to some
value other than the default or that of which you defined when you
declared the property on the ActionForm.
Basically, the reset method is called before the request reaches the
Action.
Hope that answers your questions.
On 1/3/06, fea jabi <[EMAIL PROTECTED]> wrote:
> When exactly this method has to be used and when does this get called?
>
> Why do the checkboxes have to be reset?
>
> Prepopulating the formbean is done in Action class. hence, it's not
clear to
> me the exact use of using the reset method.
>
> Thanks.
>
> _________________________________________________________________
> Is your PC infected? Get a FREE online computer virus scan from
McAfee(r)
> Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Virtually,
Andre Van Klaveren
Architect III, SCP
Global Public Sector
Unisys Corporation
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]