JavaWeb project development steps

JavaWeb project development steps

Foreword: Following the video learning to build and implement the smbms supermarket management system, I learned a lot about project implementation. Here is the feeling after doing the smbms project of javaWeb, mainly talking about the overall impression, recording learning and publishing and sharing

1. Project requirements

1. What functions need to be completed
  1. Define the entity class and write it into the database mysql
  2. Specific realization of functions (such as a supermarket management system)
2. Build the project
  1. Build a javaweb empty project, configure the dependency set in web.xml and pom.xml

  2. layered:

    • Dao layer: database connection and some data processing
    • filter layer: filter, which mainly sets the encoding problem of request response
    • pojo layer (project layer): such as placing some entity classes
    • service layer (business layer): the business layer will call the dao layer to implement specific operations, such as user login operations
    • servlet layer (control layer): calling the business layer, generally used for request forwarding or redirecting page operations, and interacting with the ui interface
    • util layer (constant layer): define some commonly used data
    • resources (resource file): put some unchanged data, such as login user and password attributes to connect to mysql, etc.
    • webapp (display layer): used for view effects, placing pictures or jsp, pictures, css, js and other front-end page styles, etc.
3. Access sequence

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-uiLiANcC-1664336272862)(img/image-20220918171725230.png)]

In general: the order in which we write code is the path opposite to the arrow above, ie

Dao layer—>Service layer—>Servlet layer

That is, the basic three-tier architecture: (connect to database, specific business, web interface)

Three-tier architecture The three-tier architecture in the usual sense is to divide the entire business application into: interface layer, business logic layer, data access layer

Ask layer. The purpose of distinguishing levels is the idea of ​​"high cohesion and low coupling". In software architecture design, layered structure

* is the most common and most important structure. *In general, the advantages of a hierarchical structure outweigh the disadvantages.

The specific levels are shown in the figure:

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-iQjAABnK-1664336272864)(img/image-20220928105724115.png)]

2. Details of the development project

  1. Design the database according to the requirements, that is, which objects are needed, table structure, naming convention, primary key auto-increment, etc. Consider designing the database

    [External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-SZdQteRX-1664336272865)(img/image-20220928110806280.png)]

  2. Connect to the database, use the IDE to connect to the database, that is, you need to operate the Dao layer, you can write a public class to perform some basic operations for database connection to obtain data

    [External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-rA00BtBN-1664336272865)(img/image-20220928111140590.png)]

  3. Perform some data acquisition operations on the Dao layer, generally customize an interface, and then an implementation class, usually ending with Impl

    [External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-8p46pzDm-1664336272866)(img/image-20220928111334440.png)]

  4. Write the business layer, realize the business, generally customize an interface, and then an implementation class, usually ending with Impl

    [External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-pNWKMvyt-1664336272867)(img/image-20220928111505212.png)]

  5. Implement the servlet layer, call the service layer, and then obtain data according to the requirements and display it on the front-end page or realize the interface jump

    [External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-VGjs6ch7-1664336272869)(img/image-20220928111924201.png)]

  6. Probably at this position, the project has basically been built. Here I only show a general process that I followed. The specific development and deployment are required.

3. Summary

  • This kind of slightly complicated project needs to consider a lot of things, and it takes a lot of time and energy to do it completely by yourself. If there are related methods and codes that have been implemented by others or are relatively mature, or basic development steps, it can be used for reference by novices.
  • It is a good way to get familiar with the project process and follow along
  • When learning, there are some related extensions to learn more about and dabble in
  • Doing this project is relatively difficult, and you need to continue to explore, keep learning, have learning motivation and goals, so that learning will not be dull and exhausting too quickly.

Here are two links, one is the link of Crazy God javaweb learning:
https://www.bilibili.com/video/BV12J411M7Sj
and the other is the link of my novice warehouse:
https://gitee.com/he-ze__-an /projects

Guess you like

Origin blog.csdn.net/qq_51326491/article/details/127086588
Recommended