1. MVC Design Pattern
Model 1 Architecture mode (basically no use)
The core of model 1 is the JSP file, and the project developed using Model 1 contains a large number of independent JSP files and a small subset of JavaBean. When developing with model 1, the JSP is responsible for receiving form parameters, processing business logic, and ultimately returning the results to the client's browser side.
The program flow of Model 1 is relatively easy to understand. The user submits the information to the JSP page, the JSP accepts the user's submitted value and connects the database and the operation database through JavaBean, and then returns the result to the user.
Disadvantages:
(1) in the JSP is flooded with a lot of Java script code, late maintenance is very troublesome;
(2) Code reusability is very poor;
(3) Poor scalability, early development of the project if adding new features is very complex and cumbersome.
Model 2 Schema Mode
Model 2 is an object-oriented technology to implement the MVC pattern, thus extending the Jsp/servlet form of a new architectural pattern. MVC consists of 3 basic components, model, view, controller, respectively. (The View section generally uses the JSP to realize, the model part generally uses the JavaBean to realize, the controller part generally uses the servlet to realize).
Steps:
(1) The client is requesting the Controller;
(2) The controller calls the corresponding model according to the corresponding request;
(3) The controller then interacts with the model processing data to the view;
(4) View is presented to the client.
Advantages:
(1) The Division of labor is clear and the coupling decreases;
(2) Views and logic are further differentiated to facilitate maintenance.
Introduction to MVC Design patterns