This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session" Watch "Session" New topic
Author

Session

Vallabhaneni Suresh Kumar
Ranch Hand

Joined: Mar 01, 2004
Posts: 68
In servlets I want to do something,when the session expires.How to achive this?

Thank you
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Check this out.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionListener.html
Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
To add to the previous (excellent) reply:
- You implement HttpSessionListener.
your implementation would have code to run when session expires.
- You register this class in your web.xml:
<listener>
<listener-class>yourPackage.YourListener</listener-class>
</listener>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Session