• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call a JSP page when session expired ?

 
NR Gopinath
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai
In <session-timeout>50</session-timeout> we can able to set the session time.
I want to redirect a jsp page when a session is expired.
How it is possible.
Is there any property which we have to set in Web.xml
Please reply me immediately
Thank you
Regards
Nathan
 
Sunetra Saha
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the code I included at the top of my jsp's
<code>
if( session.isNew() ) {
if((( request.getParameter( "bypassSessionCheck") != null) &&
(! request.getParameter( "bypassSessionCheck").equalsIgnoreCase("true")))
| | (request.getParameter( "bypassSessionCheck" ) == null)) {
int safeFragsLen = safeFrags.length;
boolean safePage = false;
for( int i = 0; i < safeFragsLen; i++ ) {
if( requestedPage.indexOf( safeFrags[ i ] ) != -1 ) {
safePage = true;
break;
}
}
if( ! safePage ) {
String sessionExpiryPage = "session_expiry.jsp";
response.sendRedirect( sessionExpiryPage );
return;
}
}
}
</code>
 
NR Gopinath
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai
Thank for the code's you have sent.
But, I don't want code for that. There is some property in Tomcat itself where we can specify the JSP page and if session expires it will automatically call that JSP. I want that property which we will write in web.xml
Please send me , i am waiting for your reply
Thank you
regards
Nathan
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The magic word is "form-based login". You should study Chapter 11 of the Sevlet 2.2 spec from Sun, though - there are nuances there I wasn't aware of.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!