Unfortunately, calling reset is necessary. A primary reason is that that
if a checkbox is unchecked then it will be ommitted from the request.
This can give inconsistent results when a ActionForm is being returned
for editing. The reset method gives the developer the opportunity to set
the checkbox to a known state (to make up for the vagrancies of HTML).
The abstract implementation of reset is empty. If a developer is going
to reuse beans between requests, it is the developer's responsiblity to
see that reset performs correctly.
All the population also takes places through mutators that the developer
defines. If there are circumstances where a ActionForm should not
populate itself through the request, the developer can design the
mutators accordingly.
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/
Bob Rullo wrote:
>
> Ted,
>
> I did see that check in the processActionForm method, but if you notice, in
> the processPopulate which is called right after the processActionForm call
> you'll see that the bean, no matter where it came from, gets reset and then
> populated with the request parameters via the RequestUtil.populate method.
>
> Am I missing something here? Sure seems like it'll reset the form bean no
> matter what which to me, isn't desirable.
>
> -Bob
>
> ----- Original Message -----
> From: "Ted Husted" <[email protected]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, September 16, 2001 6:04 AM
> Subject: Re: Forwarding Actions onto other Actions
>
> > There is actually just such a check, though this would be a very good
> > suggestion if there weren't ;-)
> >
> > See processActionForm in ActionServlet.
> >
> > Please let us know if you see anything else.
> >
> > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > -- Custom Software ~ Technical Services.
> > -- Tel +1 716 737-3463
> > -- http://www.husted.com/about/struts/
> >
> >
> > Bob Rullo wrote:
> > >
> > > This is my first posting to the dev board so bare with me.
> > >
> > > >From what I've seen in looking in the ActionServlet code it appears
> that
> > > everytime a action is called the form instance for that action is placed
> > > into the mapping.getScope( ). Shouldn't there be a check before to see
> if
> > > the ActionForm is already in the scope? Reason being that one action
> could
> > > make some modifications to a form instance and then forward it to
> another
> > > action that will make more changes to the form instance. Basically my
> > > problem is that if two actions having the same form instance are called
> in
> > > the same request the form instance stored in the request will always be
> > > overridden by the last action.
> > >
> > > I propose that we should do a check before each action to determine if
> the
> > > form already exists in the desired scope. If so, use the scoped
> instance,
> > > if not, build the form instance off of the request parameters as it is
> now.
> > >
> > > If this was by design, could someone shed some light to why?
> > >
> > > Thank you for your help,
> > > -Bob