Using the Springboot framework to do a Web project to achieve a simple increase, delete, change, check the function of the flow

Source: Internet
Author: User

The main process for completing this project is as follows:

1 First of all to understand the needs, so that we can with good to design details, is to do something better meet the requirements.

2 Create the appropriate entity classes based on your needs, such as student management systems, should we create a student's entity class, and then according to the specific requirements, need

Which student's information, such as name, age, gender, ID number, class, telephone, etc. Set them all as students ' attributes.

3 According to the students ' attributes to create a student table in the database, each student's attribute is set to a field in the student table, in the setting of the field should be to let the table

The name strength in the entity class is consistent, which avoids unnecessary hassles. Second, their type should be consistent, such as the student's name is a string, age is the shape of the need to keep consistent,

And depending on the attributes, we should give them a reasonable length in the database, not too big. This will save you storage space.

4 According to the specific functional requirements to write the persistence layer, we usually design the persistence layer method as an excuse, so that we can directly write the SQL statement in an XML file.

We should pay attention to some configurations to ensure that the XML files can be scanned. This allows you to execute the SQL statements in the XML file.

When writing SQL statements, it is important to note that the ID should be consistent with the method name of the persistence layer in order to ensure that the method of the persistence layer can be called to execute the specified SQL statement to the data

to operate. Also, we should note that the return value of the method, the parameter value, and so on are consistent with the SQL. Usually we should test every method, so that we can have a problem at any time.

Solve.

5 The Writing service layer is similar to the above, we also write the service in the form of an excuse, which reduces the coupling of the code, then writes the implementation class to the service, and usually we call the persistence layer above.

The service is usually a lot of business logic. We should fulfill the corresponding business requirements according to the specific requirements. Here must be possible to think more, let do out of the logic not from in the loopholes.

6 Controller Layer He is primarily dealing with things that interact with the front end, where many request paths and types of requests are designed. And what format the front-end and back end uses to interact with the data

What we usually use is JSON, which in Springboot is the JSON format for data interaction.

7 Front end is the code on the front page we carried out a series of operations, such as to do the addition and deletion of the function, we click the corresponding button to achieve, add students, delete students and so a series of operations, can be through

JS code allows him to transfer the corresponding data and operations through the request path to the appropriate controller to allow the controller to further deal with these corresponding requests and so on. Of course, the controller invokes the service layer at the end, and the service calls

Persistence layer, so that in the end can let the database to perform the corresponding operation, and finally return to the corresponding results layer by step, so that we want to display the results in the front page.

Using the Springboot framework to do a Web project to achieve a simple increase, delete, change, check the function of the flow

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.