SPRINGMVC controller, processor, Mapper, adapter

Source: Internet
Author: User

Front Controller Dispatcherservlet

<!--define Spring MVC's Front controller servlet--
<servlet>
<!--servlet name--
<servlet-name>SpringMVC</servlet-name>
<!--servlet corresponding Java class--
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--parameter information for the current servlet--
<init-param>
<!--contextconfiglocation is the parameter name, and the value of this parameter contains the SPRINGMVC profile path--
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<!--load servlet--> as soon as the Web App starts
<load-on-startup>1</load-on-startup>
</servlet>


<!--Let Pringmvc's front-end controller intercept all request URLs (not including jsp-->
<!--servlet Mapping declaration --
<!--/means intercept all servlet requests --
<!--/* indicates that all servlet requests are blocked, JSP files--
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>



1) Dispatcherservlet after receiving the request, according to the processor mapping configured in the corresponding configuration file, find the corresponding processor mapping entry (handlermapping), according to the configured mapping rules, find the corresponding processor (Handler).
2) Call the processing method in the appropriate processor and process the request, and the processor will pass a Modelandview type of data to Dispatcherservlet, which contains the data to be used in the view and view of the processing result.
3) Dispatcherservlet find a suitable viewresolver (view parser) according to the View object in the resulting modelandview, according to the configuration of the view parser, Dispatcherservlet the view to display the data to the corresponding view, and finally constructs an HTTP response to the browser

1.DisPatcherServlet Front-end controller
Core. The user enters the URL in the browser, initiates the request, first arrives at the Dispatcherservlet, it calls the other component to cooperate the completion of the work, the existence of dispatcherservlet greatly reduces the coupling between the components
2.HandlerMapping Processor Mapper
Record URL and processor mappings in the form of annotations, XML configuration, etc.
3.HandLer processor
Back-end controllers (popular point: The business code written by the controller layer). Processing a user's request
4.HandlerAdapter Processor Adapter
The processor is executed through the Handleradapter, which is an application of the adapter pattern that can be performed on more types of processors through the extension adapter. (I don't understand it too)
5.ViewResolver View Resolver
Viewresolver is responsible for parsing the view and rendering (data filling) to show the results to the user through the page.
6.View View
View is an interface that implements classes that support different view types (JSP, freemarker, Velocity)




SPRINGMVC controller, processor, Mapper, adapter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.