• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Apporpriate place for session.setMaxInactiveInterval(20) when I have bunch of servlets and jsps

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
I'm using session.setMaxInactiveInterval(20) in order to set session time.

I'm using this in any of the jsp page or servlet 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
having 3-4 servlets 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
 
Sheriff
Posts: 28438
104
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic