struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: ActionServlets calling Actions
Date Mon, 26 Mar 2001 00:44:56 GMT

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.


View raw message