You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/06/14 08:10:02 UTC

Starter Action?

Subject: Starter Action?
From: "Christopher Cheng" <ch...@netdimensions.com>
 ===
Is it possbile to define one of the actions to be executed during startup
instead of defining a new servlet in web.xml?



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Starter Action?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 13 Jun 2002, Struts Newsgroup wrote:

> Date: Thu, 13 Jun 2002 23:10:02 -0700
> From: Struts Newsgroup <st...@basebeans.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Starter Action?
>
> Subject: Starter Action?
> From: "Christopher Cheng" <ch...@netdimensions.com>
>  ===
> Is it possbile to define one of the actions to be executed during startup
> instead of defining a new servlet in web.xml?
>

In Struts 1.1, you can define and register a PlugIn that is notified when
the Struts controller servlet is started and stopped.  The init() method
can do whatever setup things you need.

In Struts 1.0, you can accomplish the same thing by subclassing
org.apache.struts.action.ActionServlet and overriding the init() method --
something like this:

  public void init() throws ServletException {
    super.init();
    ... do my own setup ...
  }

and using this class as the "action" servlet in web.xml.

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>