Reg: Application Server startup objects
Hello...
I am using weblogic server v9. I want to hit the database and populate a couple of objects during startup of my app server and store them in application scope.
I have no idea on how to proceed. Any hints on the same will be appreciated.
~SirG
# 1
Hello SirGeneral,
You need to implement the ServletContextListener in your application. To do this add following in you web.xml
<listener-class>
AppStartListener
</listener-class>
Where AppStartListener implements ServletContextListener. Implement the contextInitialized and contextDestroyed methods of the interface. Use the ServletContextEvent argument passed to these methods to lookup your servelt context as event.getServletContext(), which is your application scope. Now do what ever you wish with it.
Also see my response to thread Disabling Multiple login of a user.
Again, , not sure why you posted in EJB forum, your issue is jsp/servlet related. You would get best responses there.
Good Luck
Regards,
NAG
Message was edited by:
nag1610