Using JAVABEAN in JSP instead of session, I don't like Session when I write a chat room with JSP, huh, in fact, when I use session to save the user login information, I have encountered a problem, I have no way, and later use JavaBean Instead of session, I feel is not bad, and good things are of course everyone to share. The code of javabean is as follows: package qqjspchat; public class userinfo {string username = null; string usersex = null; int usrLevel = 0; // class constructor public userinfo () {} // Put into the username PUBLIC VOID PUTUSERNAME (THISUSERNAME = Username;} // Get username PUBLIC STRING GETUSERNAME () {Return this.username;} // Add user gender Method PUBLIC VOID PUTUSERSEX (String UserSex) {this.userSex = UserSex;} // Get user gender method PUBLIC STRING GETUSERSEX () {Return this.usersEx;} // Published in user-level method PUBLIC VOID PUTUSERLEVEL (int Userlevel) ) {this.userLevel = Userlevel;} // Get user-level method PUBLIC INT getUserlevel () {Return this.userlevel;} The method applied in JSP is as follows: