Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Session Listener ( HttpSessionListener) is not working

843840Aug 13 2002 — edited Jun 3 2008
I 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>
-------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2008
Added on Aug 13 2002
6 comments
672 views