page 211 of HFSJ says:
An HttpSessionListener can be used to perform an action when an HttpSession has timed out.
My doubt is that listener method, sessionDestroyed() is called just before the session is destroyed, because once the session is destroyed, there is no way to access the session object. So the above statement should be
An HttpSessionListener can be used to perform an action before HttpSession is timed out..
Please clearify my doubt..thnx in advance
HttpSessionListener are configured in such a way that everytime a session is created or destroyed they are notified with proper events.
So in the statement it tries to say once session destro method is called - httpSessionListener will be called.
Originally posted by N Chaurasia:
if the sessionDestroyed method is called after the session object is destroyed, then how can i take some action of the attributes that are stored in session( since the session object is destroyed i want have access to the attributes stored in session object)
In English there is a subtle difference between "when X" and "after X". "When X" means something else happens at the same time as X. "After X" means that something else happens after X has completed. The javadocs for this method says "Notification that a session is about to be invalidated." The phrase "is about to be" is essentially equivalent to "immediately before." OK, enough of the language lesson...
Reading between the lines, I would interpret your question as: "When the sessionDestroyed() method is called, do the session attributes still exist?" The answer to that question is: yes.