Home  >  Article  >  Java  >  JavaWeb method example for implementing form registration interface

JavaWeb method example for implementing form registration interface

黄舟
黄舟Original
2017-09-09 11:11:573553browse

This article mainly introduces relevant information about the implementation method of JavaWeb form registration interface. I hope that through this article you can master this part of the content. Friends in need can refer to

JavaWeb form registration interface. Implementation method

Today I made another registration interface. I copied the previous code as always, so I decided to summarize the ideas for making the registration interface for students’ reference.


#Step1 Page implementation

In this step, the knowledge of html, css, and JavaScript is mainly used.

1) html

Establish the basic structure of the page. It is recommended to set an ID for 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 is hovered, etc. Page effects are realized.

Step2 Form verification

1) Use JavaScript for page verification

The input box gets focus, Hide error message
The input box loses focus and is verified
All input boxes are verified when submitting

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

2) Use Ajax for server-side verification

Verification Content:
Whether the user name has been registered
Whether the email address has been registered
Whether the verification code is correct

Step3 Submit registration

Using JavaWeb’s classic architecture Servlet—Service—Dao

1) Servlet

Verification parameters: The verification parameters here are It is a verification in the true sense. The previous verification was just a need to improve the user experience. Note that if an error occurs, the information previously entered by the user must be echoed, otherwise the user will go crazy. .
Encapsulate the form data into JavaBean
Transfer the form data to the Service to complete the business
Save the registration success information
Forward to the success interface to display the success information

##2) Service

Complete the information of the JavaBean object (id, activation code and other information not entered by the user)

Call Dao to save the data to the database
Send activation email

3) Dao

Add data to the database


A basic registration interface can be completed through these three steps. Here I only talk about ideas, I believe there are many code implementations on the Internet.

The above is the detailed content of JavaWeb method example for implementing form registration interface. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn