Re: Method or function to be executed on tomcat startup
On Friday 18 July 2008, Mikolaj Rydzewski wrote: Edoardo Panfili wrote: xx.ServerInit is a regular servlet the code is in init(ServletConfig config) method Use of ServletContextListener is preferred. That worked very well, thanks for the hint. Helpful article: http://www.stardeveloper.com/articles/display.html?article=200901page=1 To OP: put properties Map in ServletContext and it will be accessible for both servlets and JSPs (which are the servlets anyway). - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Method or function to be executed on tomcat startup
Yves Glodt ha scritto: Hello, this is probably a FAQ, but I failed to find ti anyway... Where can I declare a static method that I want to be executed on tomcat or webapp startup? I use this in web.xml servlet descriptionEnv init/description servlet-nameServiziServerInit/servlet-name servlet-classxx.ServerInit/servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameServiziServerInit/servlet-name url-pattern/SI/url-pattern /servlet-mapping xx.ServerInit is a regular servlet the code is in init(ServletConfig config) method edoardo I have a properties file which I would like to read into a Map on startup, and have this Map available throughout my servlets and jsps. How would I access this Map while the webapp is running? I use a static variable, but maybe that someone can describe a more polite method. Edoardo - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Method or function to be executed on tomcat startup
Edoardo Panfili wrote: xx.ServerInit is a regular servlet the code is in init(ServletConfig config) method Use of ServletContextListener is preferred. To OP: put properties Map in ServletContext and it will be accessible for both servlets and JSPs (which are the servlets anyway). -- Mikolaj Rydzewski [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]