I am having one application with 4-5 jsp and I am maintining sessions in between all pages,I am also writing the record for the user who has loggedIn in a .properties file. Now when the user logs out then the user name should get removed from that .properties file, if he logs out properly then i can write methods to remove his name. But how to do the same job when the user directly closes the browser or the session times out? I need to write some code when the user session gets killed or times out. I need some help in how and where to handle the timeout or session killing event. any help will be regarded with high spirits.
Originally posted by Soumik Basu: Thanks for your reply. But could you please tell me how to handle the situation when the user directly closes the browser and hence kills the session.
Closing a browser will not kill a session. It may make it impossible for the user to access that session but it will not immediately kill it. The orphaned session will remain on the server until it times out.
I have written this code in my jsp file after importing the sessionBindListener class.I am writing my sessionBindListener.java class below.
in my web.xml I had to add the following
and in close.jsp I am writing the code for session invalidation.
Its working fine. But I have to add this page in a portal and this portal will run ion browser. So can anyone please tell me how to handle the browser closing of a portal. I am using BEA weblogic8.1 portal server. [ November 26, 2008: Message edited by: Soumik Basu ]
Hi, really it is interesting. yes I have done it in one of my application using Ajax call. The idea you came up with it's close to mine too. You have used a close.jsp instead make a Ajax call. your request should go to a servlet wher your logic should be placed to remove the entry from your property file.It should work as it is working for me. I am using WSAD5,JAVA1.4,Struts1.2.
Best of luck.
subject: session handling in case of abnormal shutdown