File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSP
Bookmark " session-timeout & setMaxInactiveInterval()" Watch " session-timeout & setMaxInactiveInterval()" New topic

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)
[ April 17, 2002: Message edited by: Rex Rock ]
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

this sets the session-timeout for the entire app to 10 minutes
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.....
- madhav

Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: session-timeout & setMaxInactiveInterval()
It's not a secret anymore!