Before using spring MVC, let's first understand why we're using spring MVC. We can look at the simple development of Java Web in this question.
1. The servlet development phase
In the 90 's, with the rapid development of Internet and browser, the B/S model based on the browser developed with the hot development. Sun proposes a servlet system that enables Java programmers to develop Web applications based on the B/S architecture, using servlet classes to encapsulate HTTP requests and responses in standard Java classes to implement a variety of Web application scenarios.
One problem with Servlets is that the output of the page is returned through the Servlet class, which makes it easy to develop various page effects and colorful styles .
So Sun borrowed from ASP to launch the JSP
2.jsp Development phase
When the JSP is introduced, the Java programmer can add the server code to the static page which has been designed by the designer, and then the JSP file is automatically parsed by a JSP container and converted into a servlet class to be run by the Web servers. JSP understanding is to design the display page first, and then turn the display page into the servlet output.
The use of JSP to improve the development efficiency, but there are still some problems: first page has a large number of Java logic Code, front-end artists in the maintenance is to consider these logic code, and Java programmers in maintaining Java code is to consider the front-end display logic.
So Sun introduced the MVC pattern
3.MVC Development phase
The MVC pattern divides the program into three modules: a data Module (model), a Business logic module (Controller), and a display module (view). The Business Logic Module (Controller) accepts the request, processes the business logic, eventually generates the data (model), the Display module (view) accepts the data (model) renders the page, and finally returns the display content.
This separates the business logic processing from the display rendering and is associated with the data module.
Spring MVC (1) Why use MVC