my dog learned polymorphism*
The moose likes JSP and the fly likes increase session life time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "increase session life time" Watch "increase session life time" New topic
Author

increase session life time

joseph prabhu
Ranch Hand

Joined: Feb 26, 2008
Posts: 162
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
K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109
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.
Johnson Abraham
Greenhorn

Joined: May 31, 2004
Posts: 19
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
Karthikeyan Ramaswamy
Ranch Hand

Joined: Apr 30, 2008
Posts: 41
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).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: increase session life time
 
Similar Threads
setting max-bean-life
Session query
Session Management
Session
Regarding Session life time