Getting Started with case studies and spring principle

Springmvc implementation of the principle:

 

 

First, the entry-case execution flow

1. When you start the Tomcat server, when configured as a load-on-startup tag, it will create DispatcherServlet object
will load springmvc.xml profile
2. Turn the comment scanned, HelloController object is created
3. index.jsp transmission request, the request will arrive first DispatcherServlet core controller, according to the configuration @RequestMapping annotation
particular method performed found
according to the method of performing the return value, then the parser configuration of a view, to find the specified name specified directory JSP file
5. Tomcat server to render the page, respond

Two, SpringMVC official graphics

Third, the entry-case analysis of the components

1. The front-end controller (the DispatcherServlet)
2. Processor mapper (the HandlerMapping)
3. Processor (Handler)
4. Processor Adapter (HandlAdapter)
5. The resolver view (View the Resolver)
6. The view (View)

Four, RequestMapping comment

1. @RequestMapping annotation action is a request to establish a correspondence between the URL and the processing method
2. @RequestMapping annotation may act on the methods and class
  1. Class act on: the first level of access the directory
  2. acting on the method: the first two access directory
  3. details: can not write path / root directory represents the start of the application
  4. details: $ {pageContext.request.contextPath} also can be omitted, but can not write path /
3. @RequestMapping properties
  1 . url path specified in the request path  
  2. value value and path attribute properties are the same as
  3. mthod specified embodiment of the process request
  condition 4. params restriction request parameter specified
  request header 5. the request sent must be included in headers

 

Guess you like

Origin www.cnblogs.com/flypig666/p/11516430.html