Bookmark Topic Watch Topic
  • New Topic

listener help

 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi i have the following listener



before my session is timeout sessionDestroyed is called. I log some message, and then i want to forward it to a new jsp saying session timeout. How can i forward the control from this method to the new jsp.

thnx in advance
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
You can't. We're dealing with a stateless protocol, which means the server can only respond when the browser requests a page. The server is not allowed to "push" a response to the browser without having received a request!

Think about what happens during a session timeout. It means the browser hasn't requested anything from the server in a long time. No request means no response.

There's a couple ways around the problem:
One is that you can add javascript to the pages to perform the forwarding, using the same amount of time as used for session timeouts.
Another solution is to use an Intercepting filter. The filter can check if a session exists and, if the session doesn't exist, forward the user to the special jsp. The user won't know that the session timed out until they submit a request after the timeout, but it works.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Continued
 
    Bookmark Topic Watch Topic
  • New Topic