Hi,
I have my own ResourceFactory which returns a bean. I configure this
resource factory in tomcat 5.5 context xm file.
I would like to create a application scope variable on tomcat startup
and assign the value from the bean.method().
Is there anyway we can do it using web.xml?
This can eliminate to create JNDI initialContext in every jsp as I
would be dependent on this application scope variable on each page.
Thanks
derek - 27 Apr 2007 14:14 GMT
look into the ServletContextListener class.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContextListener.html
it can be registered to receive events when your application starts and when it ends.
registering it is as simple as placing lines like this in your web.xml file.
<listener>
<listener-class>com.yourpath.YourContextListener</listener-class>
</listener>