10. MVC three-tier architecture
What is MVC: Model (model), View (view), Controller (controller)
10.1, early years
Users directly access the control layer, and the control layer can directly operate the database
servlet--CRUD-->数据
弊端:程序十分臃肿,不利于维护 servlet的代码中:处理请求、响应、视图跳转、处理JDBC、处理业务代码、处理逻辑代码
架构:没有什么是加一层解决不了的
程序猿调用
JDBC
Mysql Oracle SqlServer...
10.2, MVC three-tier architecture
Model
- Business processing: business logic (Service)
- Data persistence layer: CRUD (DAO)
View
- display data
- Provide a link to initiate a Servlet request (a, form, img)
Controller (Servlet)
- Receive user's request: (req: request information, Session information)
- Hand over the corresponding code to the business layer
- Control view jump
Login--->Receive the user's login request---->Process the user's request (obtain the user's login parameters, username, password)---->Pass it to the business layer to process the login business (judging whether the user password is correct: things) ---->Dao layer queries whether the user name and password are correct---->Database
https://www.bilibili.com/video/BV12J411M7Sj?p=24&spm_id_from=pageDriver