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);
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:
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