Hi Geeta,
What I can say that check again your coding because we have application
in place with Servlet2.3, tomcat5.0.19 and struts1.1. And in
sessionDestroyed method I am able to trap the attribute which are
associated with the session. 
It just work fine for us.

-Jignesh 



On Fri, 2004-07-30 at 10:00, Geeta Ramani wrote:
> Hi everyone:
> 
> I would like some clarification regarding the HttpSessionListener. (We are using 
> servlet spec 2.3) 
> 
> Here's what I want to do: When a session expires, either when a user uses the 
> "logout" feature or due to time-out, I want to delete a certain row from the 
> database. The specifics of which row to delete is stored in an attribute in an 
> "user" object in the session. 
> 
> My existing solution which i don't believe works: Write a class that implements the 
> HttpSessionListener and override the sessionDestroyed(HttpSesssionEvent) method. In 
> the sessionDestroyed method, call the HttpSessionEvent.getSession() to get the 
> session, query the session to get the user and carry on.
> 
> However, here's an entry in my logs:
> "java.lang.IllegalStateException: getAttribute: Session already invalidated"
> 
> So i looked up the Javadocs for the HttpSessionListener and indeed here's the 
> description for HttpSessionListener.sessionDestroyed method: 
> 
> Notification that a session was invalidated. . 
> 
> Note the use of the *past* tense!! Thus, for example, it seems you cannot query the 
> session for anything at this point!
> 
> Googling produced this page which seems to describe the problem I am facing. 
> http://archives.java.sun.com/cgi-bin/wa?A2=ind0207&L=servlet-interest&F=&S=&P=32332
> 
> Since this (and others I found like it) are dated over two years ago, I'd like you 
> comments on:
> 
> Proposed solution: Seeing as it seems that I cannot query the session for any 
> attributes after it has already been invalidated, I therefore should make my 
> **User** class implement the HttpSessionBindingListener interface and overwrite the 
> valueUnbound method.
> 
> Is my understanding correct? How do others do this sort of thing?
> 
> Thank you in advance for any replies!
> Geeta
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to