Javaweb Online book Store complete project--day02-5.ajax verification function server-side three-tier implementation

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.