File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 60046

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] [Bear's FrontMan] [About Bear] [Books by Bear]
Don't get me started about those stupid light bulbs.
subject: redirecting page
Similar Threads
include page ...problem
redirecting useing session in jsp
Session timoeout on JSP
Checking session
Session Time out in JSP