File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

increase session life time

 
joseph prabhu
Ranch Hand
Posts: 162
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
K Kiran Kumar
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Johnson Abraham
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Karthikeyan Ramaswamy
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • 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).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic