Where and how can I define an application level variable that gets initialized at container startup? Something like the Application_OnStart Sub in the global.asa file of MicroSoft ASP.

Alex Chaffee

Make an InitServlet and initialize it in there. See I want the servlet container to load one or more servlets when the container is first fired up, as opposed to when a client issues a request for the servlets. How do I do that under Servlet 2.2 API?. Create it, then put in as a ServletContext Attribute.

MyData mydata = new MyData();
getServletContext().setAttribute("some.attribute.name", mydata);
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact