voyent
Logout on session expires or invalidates.  XML
Forum Index -> General Help
Author Message
kingsha


Joined: 12/May/2009 00:00:00
Messages: 24
Offline


Hi. I have a basic question. In my IceFaces webapp...I have a LOGOUT button. This button takes the user back to the login page and also writes a small SQL statement in a db. The SQL simply notes their logout time (this is of course for logging purposes).

My question is. Sometimes a user just closes the browser without using the LOGOUT button. Other times...they just leave it idle and the "session invalidation" thing comes up after I think 20 mins. What I want to do is...find the code for the session invalidation thing...and simply add a couple lines to input the SQL statement for the user's logout time. So basically...everytime the session invalidates...I would like to input that small SQL statement stating the time.

Quite simple but I have no clue how to do this. I tried searching for this a little but could not find it. Any insight is welcome!
venu_dvmr

Joined: 30/Sep/2008 00:00:00
Messages: 58
Offline


Implement HttpSesstionListiner and override sessionDestroyed method
kingsha


Joined: 12/May/2009 00:00:00
Messages: 24
Offline


Hi. Thanks for the reply. I am quite new to JSF and Icefaces. Could you please expand on your response. How am I to implement and destroy the said methods?
venu_dvmr

Joined: 30/Sep/2008 00:00:00
Messages: 58
Offline


It is nothing to do with icefaces or JSF. Below is the example

Code:
 package com.test.view.listener;
 
 import javax.servlet.http.HttpSessionEvent;
 import javax.servlet.http.HttpSessionListener;
 
 public class AppSessionListener implements HttpSessionListener {
 	
 	public void sessionCreated(HttpSessionEvent arg0) {
 		// TODO Auto-generated method stub
 	}
 
 	public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
 		// TODO Auto-generated method stub
 		// write your code.....
 	}
 
 }
 



in web.xml define the listiner class
Code:
 <listener>
 		<listener-class>
 			com.test.view.listener.AppSessionListener
 		</listener-class>
 </listener>
 

 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team