MVC is the abbreviation for Model-view-controller, the model-view-controller. MVC is a design pattern,
It divides the application into three core modules: models, views, and controllers, each of which handles its own tasks.
1. Model
A, the model is the main part of the application, and the model represents business data and business logic.
b, a model can provide data for multiple views.
C, because the code applied to the model can be reused by multiple views only once, it improves the reusability of the code.
2. View:
Simply put the Java code on the page to implement the display.
In detail, the view is the interface that the user sees and interacts with, with the following functions:
A. View displays relevant data to the user
b, accept the user's input
C, do not carry out any actual business processing
3. Controllers (Controller)
A, the controller accepts the user's input and invokes the model and view to complete the user's needs.
B, the Controller accepts and decides which model component is called to process the request, and then decides which view to call to display the data returned by the model processing.
Accept requests---> GET request Parameters---> Call the DAO method---> May put a DAO method's placement in Request---> forwarding or redirecting pages
In the actual process, the equivalent of a a.jsp sending a GET request to the servlet requires all student information, and then the servlet's Doget () method calls
The model layer DAO's GetAll () method returns the student's list object, puts the resulting object in the request, and then requests forwarding to b.jsp,b.jsp.
The data sent over is traversed and displayed. The DAO object is of course called the GetAll () method, returning the value to list.
MVC instance Application