[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: prepopulating check boxes when first form comes up. during reset?
From:       "Michael Jouravlev" <jmikus () gmail ! com>
Date:       2006-02-27 21:15:42
Message-ID: 1db115340602271315n767710ereb972bbb751c5d34 () mail ! gmail ! com
[Download RAW message or body]

On 2/27/06, SIRAGHER, JOEL <JOEL_SIRAGHER@appsig.com> wrote:
> Hi all:
>
> I am trying to pre populate checkboxes on struts 1.1 jsp. When the user
> goes to the url, I am setting the default values of the checkboxes in
> the reset function. Is this the correct way to go?

The request/response cycle goes like this:
* Create ActionForm if needed
* ActionForm.reset() (I am not sure is it called when form has request
scope, I hope it is)
* populate ActionForm with request data using setters
* ActionForm.validate()
* On error forward to location set in the "input" attribute of the
action mapping; otherwise call Action.execute()

Now you decide is reset() an appropriate place or not. There is no
"correct" way. If you use the same ActionForm in different actions or
for different phases (setup or submit) you want to make sure that you
populate form only on setup phase, and you clear checkboxes only on
submit phase before they are set from request.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic