Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Query reg JSP session  RSS feed

 
P Lavti
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The session object is by default available in JSP. I want to know if the session is timed out, then does it create a new HttpSession and returns that or it return null.

If it creates a new session, how can I stop that and re-direct user to session timed out page?

Thanks!
 
P Lavti
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the answer that by using page session="false" it wont create a bew session. and the existing session can be taken from request.

But if the session is expired then how can I re-direct the user to log-out page is still a question from me.

I know one way is to manually redirect the user to logout page if session is NULL.

Is there a way to do the same using JSP page directives?

Thanks!
 
Ashok Kumar Babu
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't we map a error page(actually a signup Page) in web.xml to the exception or the error code which would be thrown for a invalid session?

I am not able to find error code for this exception.
 
Ashok Kumar Babu
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Latvi,

In the sessionDestroyed method of SessionListener, forward to the signup page using the Servlet Context's request dispatcher.

Any Suggestions?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!