in our development, the most commonly used development mode is the MVC pattern, namely M--model, V--view, C--controller, so that not only can facilitate the development of the Division of Labor collaboration, improve the development efficiency, enhance the maintainability of the program and expand, And the controller separates the model from the view, reducing the coupling between them. The following diagram illustrates the application of MVC in Servlets and JSPs.
Looking at this picture, we can probably see the MVC in the servlet+jsp development of the specific embodiment of the various modules, perhaps the above painting or can not be specifically described in the MVC they represent the specific meaning and role, let us specify:
① Model: The model holds all the data, state and program logic, the model is independent of the attempt and the controller, and the model is mainly embodied in the data carrier JavaBean and the program logic Service layer and the DAO layer that produce the data.
② view: Used to render the model. The view usually takes the state field data that it needs to display directly from the model. For the same information can be multiple different display forms or attempts, the main embodiment of the view on the JSP.
③ controller: In the middle of the attempt and the model, is responsible for accepting the user input, parsing the input and feedback to the model, usually a view has a controller, the main embodiment in the servlet.
So far, the embodiment of MVC in servlet+jsp and the description of the MVC pattern has been completed, there are insufficient places, I hope you have a lot of advice!
JSP+SERVLET+MVC mode diagram