KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > servlet > http > HttpSessionListener

javax.servlet.http
Interface HttpSessionListener

All Superinterfaces:
EventListener
See Also:
Top Examples, Source Code, HttpSessionEvent

public void sessionCreated(HttpSessionEvent se)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[246]Session Counter
By Anonymous on 2003/04/28 17:09:52  Rate
import javax.servlet.http.HttpSessionListener; 
 import javax.servlet.http.HttpSessionEvent; 
  
  
 public class SessionCounter implements HttpSessionListener  {  
  
  
     private static int activeSessions = 0; 
  
  
     /* Session Creation Event */ 
     public void sessionCreated ( HttpSessionEvent se )   {  
         activeSessions++; 
      }  
  
  
     /* Session Invalidation Event */ 
     public void sessionDestroyed ( HttpSessionEvent se )   {  
         if ( activeSessions  >  0 )  
             activeSessions--; 
      }  
  
  
     public static int getActiveSessions (  )   {  
         return activeSessions; 
      }  
  } 


public void sessionDestroyed(HttpSessionEvent se)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags