aspose file tools*
The moose likes Servlets and the fly likes Checking for valid session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Checking for valid session" Watch "Checking for valid session" New topic
Author

Checking for valid session

ShivPrakash Srivastava
Ranch Hand

Joined: Mar 24, 2005
Posts: 88
Hi,

Is there any method in HttpSession or in the request to check for session timeout?

Thanks and Regards
Shiv
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
if request.getSession(false) is null , then session has timed out or never created.


Rahul Bhattacharjee
LinkedIn - Blog
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The simplest way, I've found, is to bind an object to session when a user logs in. Then check to see if that object exists (is not null).


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
add a Session listener ?
pascal
ShivPrakash Srivastava
Ranch Hand

Joined: Mar 24, 2005
Posts: 88
Hi All,

Thanks to all of you for your response.

Thanks and Regards
Shiv
 
 
subject: Checking for valid session