User login is used in a recent project in a project, of course, is to keep it using session. This is implemented with the Implements httpsessionBindingListener interface. This is the brief code I wrote. public class OnLineUser implements HttpSessionBindingListener {private NewUser newUser = null; public OnLineUser () {newUser = new NewUser ();} public boolean existUser (String str) {return false;} public void valueBound (HttpSessionBindingEvent e) {String tempName = e. GetName (); // integer m = new integer (TempName); newuser.setUsername (TEMPNAME); try {newuser.UpdateOnline ();} catch (exception ex) {} system.out.println ("User" Tempname " upper limit ");} public void valueUnbound (HttpSessionBindingEvent e) {String tempName = e.getName (); // Integer m = new Integer (tempName); newUser.setUserName (tempName); try {newUser.updateUnline ();} catch (Exception ex) {} system.out.println ("User" TempName "Lower Limit");}} Tune OnlineUser OnlineuseUser = New Onlineuser (). Setttribute (Login_no, "() .SetAttribute (login_no, Onlineuser); where login_no is the variable is the login name. At the same time, set the Request.GetSession (false) value to false, he has two values of true and false, and true is created if there is no identical session. If it is overwritten, False does not create anything is not created, I have to use this implementation single point to log in so I use false. This can monitor the session you created. If the session is timeout, the ValueunBound method is executed. Creating a session executing the valuebound method. I am here to make changes to a status field of the person. This way when this user is online, another user can be judged when the other machine is online. There are a lot of information on this area, and later encountered the problem is when setting the session timeout at 1 minute. User does not have normal exit After one minute, you can change the user 's offline, but if the user does not operate in 1 minute, the computer does not operate at the same time, I have been looking for a long time online, there is no information in this area.