On Sun, 25 Mar 2001, G.L. Grobe wrote:

> 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.
> 

The correct Action is selected by the controller servlet
(ActionServlet) for you, based on the request URI that you submit a form
to.  For example, the example app supports actions like "/logon",
"/editRegistration", and "/saveSubscription" -- each of which calls a
separate action.


Craig


> ----- 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