First of all, thanks to all who answered to my previous posting!

I did not want one of this big "use another framework 
[Spring/AppFuse/Hibernate/...] in addition to Struts2" things. While this is 
surely the right way to go for a lot of heavy weight systems there are also 
smaller lightweight apps which need some initialization at startup time (and 
btw: these other frameworks themselves need a hook to the lifecycle events of 
the web app)

Finally I found the way to go:

just use a ServletContextListener and put the configuration parameters you need 
in the deployment descriptor web.xml.
The only "trick" needed: use <context-param> instead of <init-param>!
One can access these context parameters the same way like servlet init 
parameters:
use 

...
public void contextInitialized(ServletContextEvent lcEvent) {
                
    ServletContext context = lcEvent.getServletContext();
    String par = context.getInitParameter("foo"); // this will access the 
context parameter "foo" from web.xml
    ...

}

Martin


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

Reply via email to