Thanks for the insight on the reset() method.

Chuck

At 09:40 AM 5/18/2002 -0700, you wrote:


>On Sat, 18 May 2002, Galbreath, Mark wrote:
>
> > Date: Sat, 18 May 2002 11:27:15 -0400
> > From: "Galbreath, Mark" <[EMAIL PROTECTED]>
> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> > Subject: RE: Small Complaint - Struts Impl.
> >
> > Ted/Craig,
> >
> > Speaking of states (like the insane one I find myself in, being in the
> > office on yet another Saturday :-( ), the spec allows the specification of
> > scope for an ActionForm in struts-config.xml but I've found it has no
> > effect.  For example, I specify an form bean in session scope, but all the
> > properties get reset to defaults after every "pass through" by the Action.
> > The only way I've found to maintain the bean's state is removing the 
> body of
> > reset() in the bean and providing only a call to super.reset( mapping,
> > request ).
> >
>
>If you are resetting evertying to defaults in your reset() method, that is
>exactly what you should expect.  Struts calls reset() before it populates
>the form bean properties, on every request -- so, if you have your form
>bean in session scope, you'll only want to reset properties that are
>present on the current page (and will thus get repopulated with their
>current values).
>
> > I'll be testing my app with multiple clients soon, but what I'm not 
> clear on
> > now is how Struts handles beans in session scope with respect to different
> > simultaneous clients.  Does ActionServlet create a pool of stateless beans
> > to serve each client, or are multiple clients going to see the state of the
> > bean previously set by a separate client?  My understanding is that the
> > Action uses one instance of a bean like a singleton, resetting its
> > properties before releasing it to service another thread.  If this is
> > correct, what exactly is happening if the bean is declared in session scope
> > and/or the reset() is stripped?
> >
>
>Although Action instances are singletons, form beans are not.  Form beans
>placed in request scope are instantiated on every request, while form
>beans placed in session scope are created only if they are not in session
>scope already.
>
>After that decision, form beans are treated identically, no matter which
>scope they are in.  In particular, reset() is called on every request.
>
> > Mark
> >
>
>Craig
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to