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:
ApplicationListener.
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 retrieve
Vineesh,
You should probably use a ServletContextListener . It will give you control
when the web application starts and when it ends, among otherevents. It is
pretty well described in the servlet spec and is pretty simple.
HTH -Richard
-Original Message-
From: vineesh kumar [mailto:[E