Implementation of java web form registration interface

Implementation of java web form registration interface

Today, I made another registration interface. As always, I copied the previous code, so I decided to summarize the idea of making a registration interface for students' reference.

Step1 page implementation

In this step, we mainly use the knowledge of HTML, CSS and JavaScript.

1) html

Establish the basic structure of the page. It is recommended to set the ID of each element when making HTML to facilitate subsequent CSS and JavaScript operations.

2) css

Set the length, width, margin, border, background and other styles for the node.

3) js

Set the background change when the button mouse hovers, etc. The page effect is realized.

Step 2 form verification

1) Page verification using JavaScript

The input box gets the focus, hides the error information, and the input box loses the focus. Verify all input boxes when submitting

Verification content: whether the input content is empty, whether the input character length is consistent, whether the two passwords are consistent, etc

2) Server side validation using ajax

Verification content: whether the user name has been registered, whether the mailbox has been registered, and whether the verification code is correct

Step 3 submit registration

Using the classic architecture of Java Web, servlet -- Service -- Dao

1) Servlet

Verification parameters: the verification parameters here are the real verification. The previous verification is only a need to improve the user experience. Note that if an error occurs, you should be able to echo the information entered by the user before, otherwise the user will go crazy.. Encapsulate the form data to the JavaBean, transfer the form data to the service, complete the business, save the registration success information, and forward it to the success interface to display the success information

2) Service

Complete the JavaBean object information (ID, activation code and other information not entered by the user) and call Dao to save the data to the database and send the activation email

3) Dao

Add data to database

A basic registration interface can be completed through these three steps. Here we only talk about ideas and code implementation. I believe there are many online applications.

If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>