aspose file tools*
The moose likes JSP and the fly likes  session-timeout & setMaxInactiveInterval() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark " session-timeout & setMaxInactiveInterval()" Watch " session-timeout & setMaxInactiveInterval()" New topic
Author

session-timeout & setMaxInactiveInterval()

Rex Rock
Ranch Hand

Joined: Jun 25, 2001
Posts: 82
I was wodering whats the difference between <session-timeout> in web.xml and the function call
session.setMaxInactiveInterval() function call apart from their argument type difference( minutes and seconds).
From the name, session.setMaxInactiveInterval(300) will close the session for after an inactive period of 5 minutes.
Thats clear.
What about <session-timeout> ?? Does the number we specify in <session-timeout> also relate to inactive period? or is it the whole session period (irrespective of active/inactive)
Rex
[ April 17, 2002: Message edited by: Rex Rock ]
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

this sets the session-timeout for the entire app to 10 minutes
<session-config>
<session-timeout>10</session-timeout>
</session-config>
you can check this setting by calling session.getMaxInactiveInterval() and you can change it dynamically by calling session.setMaxInactiveInterval(int seconds)
so basically -- they do the same thing -- one at run-time, one at deploy-time
-- You can find more info about this in the Servlet 2.3 specification SRV.7.5


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
We recently debated this topic in the SCWCD forum. Checkout the difference and the recommendations.
Part of my preparation for the cert.....
regds.
- madhav


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session-timeout & setMaxInactiveInterval()