It's not a secret anymore!
The moose likes Servlets and the fly likes How to use setMaxInactiveInterval() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to use setMaxInactiveInterval()" Watch "How to use setMaxInactiveInterval()" New topic

How to use setMaxInactiveInterval()

Sundaralingam Subramaniyan

Joined: Sep 07, 2007
Posts: 11
can any one explain me about setMaxInactiveInterval() method.
i have used this method as

HttpSession session = req.getSession(true);

but the problem is after 5 seconds, the session is still active.
i need assistance
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Please check your private messages.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
By using setMaxInactiveInterval you are ensuring that the session is no longer valid after the specified time of inactivity. What you have done look ok.

What are you doing to test this out? Post all your code and explain.
Gobinath Manoj

Joined: Oct 17, 2007
Posts: 11
Please give me the code fully, Bcoz your session inactive method id correct i think you have problem with your code

Thanks Regards <br />Gobinath.L
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Gobinath Manoj, please use real words when posting to the forums. Abbreviations such as "bcoz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

JavaRanch sheriff

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: How to use setMaxInactiveInterval()
It's not a secret anymore!