Hi Geeta, I am using HttpSessionBindingListener and its working fine. Subramaniam Olaganathan Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com "Geeta Ramani" <[EMAIL PROTECTED] k.com> To "Struts Users Mailing List 07/30/2004 07:30 (E-mail)" <[EMAIL PROTECTED]> PM cc Subject Please respond to HttpSessionListener vs. "Struts Users HttpSessionBindingListener Mailing List" <[EMAIL PROTECTED] he.org> 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] ForwardSourceID:NT00000C22
DISCLAIMER: The information contained in this message is intended only and solely for the addressed individual or entity indicated in this message and for the exclusive use of the said addressed individual or entity indicated in this message (or responsible for delivery of the message to such person) and may contain legally privileged and confidential information belonging to Tata Consultancy Services. It must not be printed, read, copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person other than the addressee. Unauthorized use, disclosure or copying is strictly prohibited and may constitute unlawful act and can possibly attract legal action, civil and/or criminal. The contents of this message need not necessarily reflect or endorse the views of Tata Consultancy Services on any subject matter. Any action taken or omitted to be taken based on this message is entirely at your risk and neither the originator of this message nor Tata Consultancy Services takes any responsibility or liability towards the same. Opinions, conclusions and any other information contained in this message that do not relate to the official business of Tata Consultancy Services shall be understood as neither given nor endorsed by Tata Consultancy Services or any affiliate of Tata Consultancy Services. If you have received this message in error, you should destroy this message and may please notify the sender by e-mail. Thank you.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]