Meaningless Drivel is fun!
The moose likes JSP and the fly likes redirecting page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "redirecting page" Watch "redirecting page" New topic

redirecting page

suman vasireddy

Joined: Nov 17, 2008
Posts: 12
hi im new to session concept...i just want to redirect my page to login page after my session expires so please help me out how to do this in jsp....
Somesh Rathi
Ranch Hand

Joined: Apr 27, 2006
Posts: 31

Check for session timeout in JSP inside scriplet code (you can find relevant method to check for timeout in javadoc - getMaxInactiveInterval()) . In case session timeout/remain inactive for defined time interval , redirect it to login page using the sendredirect()of HTTPServletResponse.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63848

Rather than putting Java code in scriptlets (a poor practice at this point) employ a servlet filter to do the check for you before any JSP is even invoked.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: redirecting page
It's not a secret anymore!