MVC (Model-view-controller): the input, processing, and output processes of an application are separated by Model-view-controller, so that an application is divided into three layers.
Model: Includes the business logic layer and the database access layer.
The business logic layer is typically built by JavaBean or EJB.
EJB is the core component of Java EE and can build distributed Application system. Unlike ordinary JavaBean, it consists of two interfaces and an implementation class, and contains some inherent methods for controlling the life cycle of the container.
View: typically built from JSP and HTML.
The user submits the request in the View section, the servlet gets the request, calls the appropriate business module to process it, and returns the processing result to the view (the next jump) section is displayed.
Controller: Typically made up of servlets.
When the user requests from the View section, the controller invokes the corresponding business logic component processing, and after the request processing is completed, the controller forwards to the appropriate view component display according to the processing result.
Thus, the Controller acts as a bridge between the view layer and the business logic layer, controlling the flow of data between the two.
MVC Design Pattern Workflow:
(1) The user's request (V) is submitted to the Controller (C).
(2) The controller receives the user request, according to the specific needs of the user, call the appropriate JavaBean or EJB to process the user's request.
(3) Controller call m after processing the data, according to the processing results of the next jump, such as jump to another page or other servlet
Note: The specific example can refer to the previous code
MVC design Pattern