how to auto logout a session
I hava implemented session.setMaxInactiveInterval(10) method into a servlet listener, but after 10s pass, the session could not auto logout, user still could do anything on the page, actually I would like to when session timout, user is disallowed to do things until he login again, could anyone tell me why?
[315 byte] By [
henry_22a] at [2007-11-27 5:27:14]

# 1
Just because the session gets invalidated doesn't mean the user can't do anything on a page! If the page has been loaded, it won't just disappear.
You'll see the difference if you try to access something which checks if the user is still logged in or not. If you've ever paid attention to a web-based email service like Yahoo! Mail or GMail, you'll know that if you just leave the page open, when the session does get timed out, nothing happens. But when you try to read some item, then you'll be redirected to the login page. That's how it works.
If you do want the page to redirect automatically as soon as the session times out ( not a very good idea, in my opinion, the user could be in the middle of something; you should probably give a popup with a warning ) then you'll want to use JavaScript.
# 2
Thanks for your reply! :)
My application is generating report. What I want to do is that if the session timeout event happens in the middle of generating report, the report generation could continuously process, but if timeout event happens before report generating action, I wuold like to prompt the error message on the page"The session is timout, please login again" and disallow user generate the report. Then how could I detect the session is timeout? will any methods trigger automatically?
# 3
The sesssion time out means: "If the user did not perform any event on the page for specified time,
then the session will be expired." And you can redirect user to login page.
I don't think you can use session time out in this scenario.
You better use timer for your requirement and interrupt the process of generating the report
if the maximum time to complete the generate report is over.
--
raj