Or, extend ActionServlet and put your code after the call to super.init():
--
public class fooServlet extends ActionServlet{
public fooServlet () {
super();
}
public void init() throws ServletException {
super.init();
// do something here;
}
}
--
Don't forget to update web.xml.
Dennis
<[EMAIL PROTECTED]>
10/05/2004 10:58 AM
|
|
Hi, Denis.
To get your servlet loaded after the Struts ActionServlet, simply use <load-on-startup>2<load-on-startup>
(assumed that your ActionServlet is loaded with <load-on-startup>1<load-on-startup>=. This simply tells Tomcat to load your servlet after the ActionServlet.
Hiran
-----------------------------------------
Hiran Chaudhuri
SAG Systemhaus GmbH
Elsenheimer Straße 11
80867 München
Phone +49-89-54 74 21 34
Fax +49-89-54 74 21 99
> -----Original Message-----
> From: Denis Avdic [mailto:[EMAIL PROTECTED]
> Sent: Dienstag, 5. Oktober 2004 15:55
> To: Struts Users Mailing List
> Subject: Re: Load-on-startup init servlet
>
> So I can call MessageResources.getMessageResources("blah") in
> the init() method?
> Is there an order I have to load the servlets in web.xml in
> order for that to work? (if I remember correctly,
> ActionServlet actually loads those resources, right?)
>
>
> On Tue, 5 Oct 2004 07:49:02 -0700 (PDT), Varun Garg
> <[EMAIL PROTECTED]> wrote:
> > MessageResources res =
> > MessageResources.getMessageResources("ApplicationResources");
> >
> > If you are using the property file name ApplicationResources in the
> > root folder.
> >
> > In the init method of the servlet that you are loading at
> startup, you
> > can do whatever you want.
> >
> > public void init(ServletConfig config) throws ServletException {
> >
> >
> >
> >
> > --- Denis Avdic <[EMAIL PROTECTED]> wrote:
> >
> > > I am trying to set up a start up sequence for my app but I have
> > > never set up something like that.
> > >
> > > Basically I want to initialize some classes with
> attributes found in
> > > my resources file. How would I go about doing this?
> > > I set up my
> > > web.xml file to load a servlet on startup, but I am not
> sure how I
> > > am supposed to get to the message resources that are
> loaded in the
> > > ActionServlet.
> > >
> > > I know I saw this done before but I can't remember how it was set
> > > up.
> > >
> > > Thanks.
> > >
> > > Denis
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]