Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

redirecting page

 
suman vasireddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
Eclipse IDE Hibernate Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic