The regist.jsp page has an asynchronous pull server to validate the form:
L Check if the login name has been registered;
L Check if email has been registered;
L Verify that the verification code is correct.
This illustrates the need to provide a way to support front-end requests in Userservlet.
We need to query the database user name, whether the mailbox is registered, to the session to check whether the verification code is correct.
You also need to add processing to the fields in the user table before you perform a database operation
Because the user's actions in other pages are also designed to modify the new password, confirm password, verification code and several other fields, we need to add the following fields in the user table
PackageCom.weiyuan.goods.user.domian; Public classUser {PrivateString uid;//PRIMARY Key PrivateString LoginName;//Login Name PrivateString Loginpass;//Login Password PrivateString email;//registered e-mail PrivateString Verifycode;//Verification Code Private BooleanStatus//is activated PrivateString Activationcode;//Activation Code // Add the following few fields to the private String reloginpass; // Confirm Password Private String Newloginpass; // Change the new password for the password PublicString Getuid () {returnuid; } PublicString Getreloginpass () {returnReloginpass; } Public voidSetreloginpass (String reloginpass) { This. Reloginpass =Reloginpass; } PublicString Getnewloginpass () {returnNewloginpass; } Public voidSetnewloginpass (String newloginpass) { This. Newloginpass =Newloginpass; } Public voidSetUid (String uid) { This. UID =uid; } PublicString Getloginname () {returnLoginName; } Public voidsetloginname (String loginname) { This. LoginName =LoginName; } PublicString Getloginpass () {returnLoginpass; } Public voidSetloginpass (String loginpass) { This. Loginpass =Loginpass; } PublicString Getemail () {returnemail; } Public voidsetemail (String email) { This. email =email; } PublicString Getverifycode () {returnVerifycode; } Public voidSetverifycode (String verifycode) { This. Verifycode =Verifycode; } Public BooleanIsstatus () {returnstatus; } Public voidSetStatus (Booleanstatus) { This. Status =status; } PublicString Getactivationcode () {returnActivationcode; } Public voidSetactivationcode (String activationcode) { This. Activationcode =Activationcode; } @Override PublicString toString () {return"User [uid=" + uid + ", loginname=" + LoginName + ", loginpass=" + Loginpass + ", email=" + email + ", Veri Fycode= "+Verifycode+ ", status=" + Status + ", activationcode=" +Activationcode+ "]"; }}
Javaweb Web Book Mall complete Project--day02-5.ajax verification function server-side three-tier implementation