On Tue, 31 Dec 2002, Carl Schwarcz wrote:

> Date: Tue, 31 Dec 2002 09:34:12 -0800
> From: Carl Schwarcz <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>,
>      [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Action method equivalent to Servlet's init?
>
>
> As a newcomer to Struts, I'm trying to redesign a jsp/servlet/ejb
> application to use Struts.  One issue I wonder about is that the current
> servlets make heavy use of the init() method to setup resources,
> logging, resolve ejb home objects, etc.
>
> I haven't come across an equivalent method in Action?  Is there one?
> What approach would you recommend?
>

Check out org.apache.struts.action.PlugIn, which is an API for exactly
this sort of thing.  You configure which plugins to load, and their
parameters, in the struts-config.xml file.

If you're on a Servlet 2.3 or later container (such as Tomcat 4), it's
also very easy to use the javax.servlet.ServletContextListener APIs for
stuff like this.  The contextInitialized() and contextDestroyed() methods
are called at the beginning and end of the lifetime of your application.

> Carl
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to