We configured the first DispatcherServlet class in web.xml
We request sent by the server first enters service method but our DispatcherServlet no service class method, so the method is performed automatically parent class HttpServlet abstract class parent class's parent class
Method service class HttpServlet the last request and response will be spread doGet method, the principle of proximity spread doGet parent class in FrameworkServlet DispatcherServlet
Directly to the request and response method processRequest incoming
request has entered doService method, where the method is doService DispatcherServlet class rewritten to achieve, so we enter doService method DispatcherServlet class
in doService approach, our request was introduced to many attribute value, for example (shown in two thin red circle) the IoC container, various parsers, etc., then the incoming request doDispatch method
we came doDispatch method, first define a requesting processor to perform chain mapperHandler, then define a ModelAndView Object mv, mapperHandler performed getHandler method handler for this request allocation request processor (i.e., all of the method in Controller layer), and then returns the view back mv
Then define an adapter ha, Handler format is not fixed, it is necessary to do fit HandlerAdapter processing the request
ha call handle method returns an object ModelAndView mv, where the real call handler method Controller layer
The last execution method processDispatcherResult
processDispatcherResult method, mv objects, the incoming requests and responses render method
In the render method DispatcherServlet in, access to the target view, and enter the view object's render method for
this renderMergedOutputModel method refers to the return to the page and the target method results together, is an abstract method in this class, InternalResourceView implement the method, we point go
last visited the target page request forwarded by the way
Use redirect redirect the way, is not accessible jsp page in our WEB-INF, and only through the forward (forward the request) way