You can use the Struts PlugIn mecanism too, but your init code may need some changes.

Nico.

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 15, 2003 2:11 PM
Subject: RE: Converting to Struts, where to put Servlet init() code?


You dont need to subclass the action servlet just for the init code...

Write u r own servlet(InitializationServlet)and put it in the init method of this 
servlet.

When configuring the servlets in web.xml have somethign like this.

<servlet>
        <servlet-name>InitializationServlet</servlet-name>
        <display-name>InitializationServlet</display-name>
        <servlet-class>com.urapp.InitializationServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    And for all other servlets , the load-on-startupvalue should be greater than 
1.This ensures that when the servlets
are initialized(Loaded), the initialization servlet is loaded first which means also 
the init method will be called
before any requests are received.


Additionally u can have any startup code called from the init method of this servlet.

Hope this helps.
Regards,
Shirish

-----Original Message-----
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 15, 2003 2:04 PM
To: Struts Users Mailing List
Subject: RE: Converting to Struts, where to put Servlet init() code?


subclass ActionServlet and put your inits there.

-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2003 7:43 PM
To: [EMAIL PROTECTED]
Subject: Converting to Struts, where to put Servlet init() code?



I'm converting an existing webapp to Struts.  I have some code in a
Servlet init() method, and I don't immediately see where I should put
it.  This is an authentication/authorization webapp, and the code in
question sets up an authentication handler object to be used by every
subsequent request.

What's guaranteed to get executed before the Action code?  (I'm almost
thinking Filter, and to put the object in Application scope, but I'm not
sure yet.)

Any advice?

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM

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

Reply via email to