I make a Hashtable and put it into application,Hashtable is used to store online 
number,when user visited this page,I add him into this Hashtable,like follows:

Hashtable list = (Hashtable)application.getAttribute("list");
if(list==null)
  list=new Hashtable();
list.put(user.getName(),user.getName());
application.setAttribute("list",list);

Then I can get online number through this Hashtable,like follows:

int number;
Hashtable list = (Hashtable) application.getAttribute("list");
Enumeration info= list.elements();
while(info.hasMoreElements())
    number++;  //online number

When user's session is timeout or user closed IE,I remove user from this Hashtable.
My question is how to know user's status in Server?

Any idea will be appreciated!
Edward

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to