Session Listener ( HttpSessionListener) is not working
843840Aug 13 2002 — edited Jun 3 2008I am using the most recent version of Tomcat Server(4.1.8). I have a simple Test Servlet which is using HttpSessionListener. Container is not invoking sessionCreated & sessionDestroyed methods when i run the servlet.
Following is the servlet code.
------------------------------------------------------------
//logMessage is my method that inserts given text into the test database.
public class dbServlet extends HttpServlet implements HttpSessionListener{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{
logMessage("doGet Method");
}
public void sessionCreated(HttpSessionEvent e){
logMessage("Session Created");
}
public void sessionDestroyed(HttpSessionEvent e){
logMessage("Session Destroyed");
}
------------------------------------------------------
DEPLOYMENT DESCRIPTOR FILE WEB.XML
------------------------------------------------------
<listener>
<listener-class>dbServlet</listener-class>
</listener>
-------------------------------------------------------