• 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:

increase session life time

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my jsp project session is being expired in 20 minutes(default).

how can i increse the session life time. where i have to write that code
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prabhu,

You can set the session timeout manually using the session.setMaxInactiveInterval(<seconds>);

For more info, check the below link.

http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)

Regards,
Kiran.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can define the session time out in your applications web.xml in the following tag

</web-app>

The value for the session-timeout tag is in minutes. The above declaration will make your session time-out to 30 minutes.


If you want to maintain the session time-out in the code itself you can do so this way

The value

36000

provided int he above piece of code is in seconds

you can also set the above value to

-1

so that session never expires
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

you can increase session time-out in 2 way,

1.Use setMaxInactiveInterval(int interval) method of the HttpSession.

2.Use web.xml, <session-timeout>20</session-timeout> Tag


setMaxInactiveInterval() takes in seconds.

web.xml effects whole web application (takes in mintutes).
 
New rule: no elephants at the chess tournament. Tiny ads are still okay.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic