File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Apporpriate place for session.setMaxInactiveInterval(20) when I have bunch of servlets and jsps
Joined: Nov 18, 2013
Mar 13, 2014 06:14:53
I'm using session.setMaxInactiveInterval(20) in order to set session time.
I'm using this in any of the jsp page or
of my web app to set session time and it is
working fine i.e, session is getting expired in other web pages also after 20sec
please tell me which is the appropriate place for session.setMaxInactiveInterval(20) if i'm
and 6-7 jsps.
I guess 1sp jsp page requested(home page) should have this statement??
please correct me..
And also please tell me If I don't use filter for this purpose what will be the problem?
thanks in advance
Joined: Oct 14, 2005
Mar 13, 2014 10:00:08
Yes, using a filter would make the most sense. When you find yourself repeating code in every servlet, then you should think of using a filter for that code.
Alternatively if you have code which specifically creates the session, such as a login page, then you could set the maxInactiveInterval at that time. But there's no harm in setting it more than once.
I agree. Here's the link:
subject: Apporpriate place for session.setMaxInactiveInterval(20) when I have bunch of servlets and jsps
Problem in invoking sessionDestroyed(se ) with struts under tomcat5
HTTP Status 405 - redirect to index page?
Session timeout problem
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014