Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to expire the browser session in case of user inactivity in java?

JavaFundaDec 26 2011 — edited Dec 28 2011
i want to expire the my browser session in case of user inactivity for 1 minutes in my web application? I tried doing two things :-

Approach1:- put the below code in web.xml

<session-config>
<session-timeout>1</session-timeout>
</session-config>

Approach2:-

session.setMaxInactiveInterval(1*60);

Both the aproaches does not expire the session. I am ablke to continue even if user does not do the activity for 3 minutes?


When it is not working:- it does not work when when i go to login screen directly and do the login.

when it works:-Though same approach works when i integrate above web application to with one of mine different web application say webapp2. What happens in this case i provided a link on webapp2 which directly takes me to webapp1 without asking login credentials. Here log out works in case user does not do the activity for 1 minutes?


i am not getting why it is not working in first case when i do the log in manually though web.xml is same and class where i put session.setMaxInactiveInterval(1*60) is executed in both the cases?

Posted at http://stackoverflow.com/posts/8634956/edit but did not get any resolution.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 25 2012
Added on Dec 26 2011
8 comments
527 views