I would highly recommend that you read "A Walking Tour of the Struts Example
Application" on Ted Husted's web site:

http://www.husted.com/about/struts/example-tour.html

I think this will clear up a lot of confusion for you.

--
Martin Cooper


----- Original Message -----
From: "G.L. Grobe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 25, 2001 6:58 PM
Subject: Re: ActionServlets calling Actions


> I thought the Action class I've been using was the controller as it
returns
> several different jsp's depending upon the outcome the population of
> ActionForms. I have a very simple example going, jsp's that use Action's
in
> the form method tag. Is this not considered the controller? I think this
is
> my point of confusion.
>
> I'm trying to figure out what's meant in the Action api, which states "The
> controller (ActionServlet) will select an appropriate Action for each
> request, create an instance (if necessary), and call the perform method."
>
> Do I need to create an ActionServlet (which will be the controller)? How
> does that then select an appropriate Action, any examples anywheres? And
> then, maybe anyone have examples of how session beans are tied in to all
> this.
>
> ----- Original Message -----
> From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, March 25, 2001 6:44 PM
> Subject: Re: ActionServlets calling Actions
>
>
> >
> >
> > On Sun, 25 Mar 2001, G.L. Grobe wrote:
> >
> > > >From the API of the Action class:
> > >
> > > "The controller (ActionServlet) will select an appropriate Action for
> each
> > > request, create an instance (if necessary), and call the perform
> method."
> > >
> > > I have working Actions getting data from my client and populating the
> > > ActionForms, but now that I'm adding a session bean, how do I do
what's
> > > explained above.
> >
> > I'm not sure quite what you are referring to when you say "what's
> > explained above".  The sentence you quoted is done by the controller
> > servlet on each request.
> >
> > > What I'm needing the servlet for is to have the init()
> > > method of the Servlet initiate my session context.According to the
> Action
> > > class docs, I need to have an ActionServlet call the appropriate
> Actions.
> > > Any examples
> > >
> >
> > The init() method of the servlet is not the right place to initialize a
> > session.  That is because init() is called only when the web application
> > itself is first started (and then it's called only once).  You would use
> > the init() method to set up *application* scope things, rather than
> > *session* scope things.
> >
> > In a servlet 2.2 environment, the best place to set up session stuff is
in
> > the Action that handles your login.  For example, the example
application
> > does this (LogonAction) to create a User bean in session scope, once the
> > user has been logged on successfully.
> >
> > > Any help much appreciated.
> > >
> > >
> >
> > Craig
> >
> >
>


Reply via email to