Re: What's Struts ...

2000-12-20 Thread craig mcclanahan

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.
> >
> > ---
> > 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.
> > ---
> > Not necessarily. FormBean would be maintained through user's session if the
> > formbean has a scope of session.
> > ---
> 
>  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



Re: DataSource

2000-12-20 Thread craig mcclanahan

"Sayles, Scott SAXONHQ" wrote:
> 
> Pardon me if I'm missing something, but is it intended that the
> javax.sql.DataSource be required in the ActionServlet?  It's just that I
> downloaded a recent build and I'm now getting errors when trying to compile
> my actions.  They relate to javax.sql.DataSource not being found on the
> import.  Is it required to have the JDBC 2.0 Standard Extensions API now?
> 
> Thanks.

To compile Struts itself, you will need to download the JDBC 2.0
Standard Extensions JAR file and put it on your classpath.  (I need to
update the README to be more explicit about this.)  If you are just
compiling your own classes, you should not need them, but will again at
runtime (even if you do not use a DataSource in your app.

Craig