aspose file tools
The moose likes Servlets and the fly likes Redirect user to login page after session expires Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Redirect user to login page after session expires" Watch "Redirect user to login page after session expires" New topic
Author

Redirect user to login page after session expires

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
I want to redirect the user to login page if his session expires. He could be on any page and if his session expires he has to be redirected to Login screen.

I am doing this... I check for the session if it is new then redirect him to login page. What's happening is I am writing this piece of code on every page and I am checking for expired session and redirecting him to login.

I want to know if there is one place where we can write the code and user will be redirected to login page irrespective of on which page he is in when his session expires .

appreciate your help
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56207
    
  13

Use a filter.

And you should be checking for a scoped variable that you place in the session, not the session itself.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
jQuery in Action, 2nd edition
 
subject: Redirect user to login page after session expires
 
Similar Threads
Invalid session
JavaScript not working in Mozilla
on session expire in iframe - open login page in parent window
User Idle Time?
j_security_check