In our blog post on Simple Spring (iv) Spring instance analysis, we can understand how the spring framework works and how it is implemented, and then we'll go on to explain an extended product in spring--spring MVC
1. Introduction to Spring MVC
Before you start demo spring, let's first introduce sprig MVC. Spring MVC is a MODEL2 MVC framework that revolves around Dispatcherservlet's core class, Dispatcherservlet is the responsibility of spring MVC to intercept client requests and organize different components for request processing. Respond to the processing results. The overall implementation of the framework diagram is shown in the following illustration:
2. Spring MVC Analysis
After a rough look at spring MVC, we do an example analysis of a simple spring MVC, and the reference instance has a link address at the end of the article. The analysis is mainly carried out from the following aspects:
A, enabling the framework
Enabling spring MVC is similar to Struts1, a simple servlet. HTTP requests are sent through the client, and the Web application server accepts and determines whether to match the request path of the Spring MVC core class Dispatcherservlet, and if the match is forwarded to dispatcherservlet for processing. The reference example given by the specific Web.xml file configuration reference. Corresponds to the following section of the above figure:
This section is a servlet run process that has nothing to do with the Spring MVC framework itself, but simply forwards the request to the core class of spring MVC, and if you have any doubts, please refer to the previous article servlets to understand the servlet run process.