
Originally Posted by
cormet
Is it possible to give me an sample of ServletContextListener code?
It could be like that (note: this is just written down and not tested):
Code:
public class ContextStroreListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent evt) {
ServletContext servletCtx = evt.getServletContext();
ApplicationContext ctx = WebApplicationUtils.getWebApplicationContext(servletCtx);
// store the context somewhere
}
public void contextDestroyed(ServletContextEvent evt) {}
}
Regards,
Andreas