File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Web Component Certification (SCWCD/OCPJWCD)
question on destroying a session
Joined: Jan 14, 2005
Mar 07, 2005 20:43:00
I was wondering if session.invalidate() is the only way to "destroy" a session.
Also, how can we figure out when the session was destroyed?
Thanks,<br />Karen<br /> <br />SCJP 1.4<br />SCMAD 1.0<br />SCWCD 1.4
Joined: Oct 20, 2003
Mar 07, 2005 21:12:00
Other options are:
1. You can configure session-config element in web.xml by which the
container ends a session if a session is inactive for a specified time.
<web-app> ... <session-config> <session-timeout>30</session-timeout> <!-- 30 "minutes" --> </session-config> </web-app>
You can also use the following method of HttpSession to programatically set the session time out period in "seconds".
public void setMaxInactiveInterval(int interval);
You can implement HttpSessionListener to get the notification when the session is destroyed. It calls the method sessionDestroyed(
). This listener needs to be configured in DD.
Thanks,<br />Durgaprasad<br />SCJP1.4, SCWCD1.4, SCBCD1.3,<br />SCEA
I agree. Here's the link:
subject: question on destroying a session
Advice on persisting complex state across multiple server trips
Alternative to Cookie?
Session problem in NetBeans
Field set in action method coming null in JSP
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015