• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling session time out in custom JSP error page

 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
iam using a custom jsp error page and its working fine,as iam displaying the error using
exception.getMessage().

But iam not able to handle the sessionTimeOut using this custom Error JSP page.
Could any one help me out or pass any suggestion?

Thanks
Raj
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could either test the isNew() property of the session or (as I do) test for the existence of an object that was put into session during the login.

Either way, once you've determined that the session is new, you could throw a new exception. This would end up forwarding the user to your custom error page.

Personally, since your code is aware of what the problem is at this point, I think it would be better to redirect the user to the login page with a message saying that their session has either timed out or that they've tried go directly to one of the application's pages without logging in first.

It's generally considered bad form to throw exceptions as part of flow handling.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic