Steve A Drake wrote:
> 
> On Mon, 19 Jun 2000, Shiraz Wasim Zaidi wrote:
> 
> > The action's servlet can then handle the request, and return a HTTP response
> > to the controller, which the controller can pass back to the client.
> >
> > ---<COMMENT>
> > I think you have a wrong understanding that action classes are servlets. No
> > they are regular java class that implements Action interface and provide
> > perform method definition that is the actions business logic.  Moreover
> > Action Classes never return response to the controller servlet i.e.
> > ActionServlet. They always return ActionForward, which might be null.
> 
>  Just so we're all on the same page here, according to the
> (0.5) documentation, an Action class is not a servlet but it has a simliar
> lifecycle to a servlet in that only one Action object is instantiated. So,
> you must consider multi-threading issues when coding your Action class
> (like you would with a servlet). Someone please correct me if this is not
> the case.
> 

This is correct for all versions of Struts, although in Struts 1.0
Action is a base class that you extend, rather than an interface that
you implement.  In addition, the Action class now receives lifecycle
indications through the call to setServlet() -- a non-null argument
tells you that this Action is about to be invoked for the very first
time, and a null argument tells you that this instance has been taken
out of service (currently, this only happens when the web application is
shut down.)


> > JavaBeans can also be used to manage input forms. A key problem in designing
> > Web applications is retaining and validating what a user has entered between
> > requests. With Struts, you can store the data for a input form in a form
> > bean, which is automatically maintained through the user's Struts session.
> > ---<COMMENT>
> > Not necessarily. FormBean would be maintained through user's session if the
> > formbean has a scope of session.
> > ---</COMMENT>
> 
>  And, looking at the processActionForm() method in the ActionServlet
> class, session is the default scope for ActionForm beans.

Session is the default scope; request is the other option.  It makes for
more scalable applications if you can use it, but requires that all of
the properties of your ActionForm bean be included in the page.

Craig McClanahan

Reply via email to