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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checking for valid session
 
Similar Threads
Session problem in NetBeans
Advice on persisting complex state across multiple server trips
Alternative to Cookie?
ASP
Field set in action method coming null in JSP