The order in which the request is received from the front desk, received in the background, and then the specified function is executed, and finally the return value is passed to the front desk.
Foreword:
- Web layer/Servlet layer (front and back-end interaction layer)
- Service layer (business layer: business code layer)
- Dao layer (persistence layer: logical code processing layer)
- Entity class (for example: User class, etc.)
- Tools (for example: Property, etc.)
The order of execution is as follows
1. First load the jsp file, jump according to the action in the form
2. Find the Servlet class corresponding to /Login in web.xml, and then jump to Servlet (UserServlet class)
3. After jumping to the Servlet, it will be based on the foreground Choose the corresponding method of the type
[Note:] The default submission method of the form without writing is get, but when we write a lot, we don’t know which one it is. Simply write it in the service, because the service can receive both the get type and the post type.
4. Jump to the corresponding method according to the value of the foreground, and then execute the corresponding business functions (for example: registration, login, etc.) of the Service layer (business layer).
Because Service is a business function interface, the actual jump to the Service is Implementation class-ServiceImpl class
5. Then jump from the Service layer to the corresponding method in the real logic code processing layer (Dao layer).
This is mainly to connect to the database, CRUD code, and the return value will be passed up if there is a return value.
6. The return value is passed back to the Servlet layer, and the Servlet can jump to different pages according to different return values. After
executing the page jump, a Servlet request-the end of the response
[Note: If you want to send the results of the query (multiple pieces) to the front desk, you can use collections and object storage, and pass the data to the front desk through the Session] For
details, please check https://blog.csdn.net/ qq_43288259/article/details/114643694