struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kwok Peng Tuck <>
Subject Re: init variables in action class ?
Date Wed, 26 Mar 2003 05:39:00 GMT
You can do this by extending action servlet.
In your servlet that does this, just provide your own init() method.
There is a example that comes with struts that does this, I think it was 
the mail reader example.

Riyaz Mansoor wrote:

>i'm a newbie to using struts so please bear with me.
>in my application (which i'm porting to struts) in
>which i formerly used raw servlets, i maintained a
>variable that was initialised on startup (and i always
>set the servlets to start automatically) as this
>variable can be needed by many other servlets at any
>time even if that particular servlet has not been
>called. so this logic was implemented in the init()
>method of the servlet. and depending on the actions
>the user took, this variable would be updated so that
>all other servlets could access the updated variable.
>after reading thru struts i'm thinking that this logic
>should (?) be included in the Action extension. my
>problem is, i don't _see_ the Action class having a
>method that gets initialized, when the ActionServlet
>starts up. perhaps i'm looking at this wrong. could
>someone explain this?
>i don't want to put the initialization in my jsp
>please help
>Do you Yahoo!?
>Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message