MVC classic three-tier architecture

M (Model model)
V (View view)
C (Controller controller)
icon: MVC classic three-tier architecture (screenshot from Kuangshen B station JavaWeb video)
MVC classic three-tier architecture (screenshot from JavaWeb video of Mad God B station)
Three levels of responsibility. Different
Model layer:
also called the business layer, responsible For business processing, business logic needs to be written at this layer. This layer is also responsible for data persistence. CRUD (Dao)
View layer (jsp):
Display data, provide links to initiate Servlet request
Controller layer (Servelt):
Accept the corresponding request, hand it over to the business layer to process the corresponding Code to control the jump of the view

Example of using three-tier architecture to implement website login function (help understanding):
login -> receive user request -> process user request (get user login parameters: username, password) -> hand over the parameters to the business layer to handle the login business ( Check if the username and password match) -> Dao layer queries the database to determine if the username and password match -> database

Guess you like

Origin blog.csdn.net/kitahiragawa/article/details/112838428