Re: How to load a class when tomcat starts

2005-12-25 Thread Anoop kumar V
Here is some code that might help you: import java.io.*; import java.net.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class InitServlet extends HttpServlet { public void init(ServletConfig config) throws ServletException { super.init(config);

RE: How to load a class when tomcat starts

2005-12-11 Thread Sethuraman, Prabhu \(Cognizant\)
Hi Vineesh, Thats simple. Just check the link below for information on ServletContextListener. This is just according to the Servlet spec with tomcat its just as easy: http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContextListener.html Sample code:

Re: How to load a class when tomcat starts

2005-12-10 Thread Anoop kumar V
The way we have done is to load a servlet during startup (very easy to do in web.xml) and through this servlet use Class.forName(classname) to load the required classes into memory. The reason we do this is to read a .properties file and store all the name value pairs in a hashmap to be retrieved