Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

listener help

 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Continued
    Bookmark Topic Watch Topic
  • New Topic