Java Development-Spring MVC Learning

Source: Internet
Author: User
Tags map data structure

Spring MVC

is actually a Java implementation of the Web MVC design pattern of the request-driven type of the lightweight web framework, is to use the MVC architecture pattern idea, the web layer decoupling, so based on the request-driven refers to the request-response model.

The front controller is Dispatcherservlet, and the application control is actually two parts: the processor mapper (Handler Mapping) for the management of the processor and view Resolver for the view. The page controller is the controller interface, including some ModelAndView handleRequest (request, response) implementations, that is, the Pojo class. Provides flexible data Elliott, formatting and data binding.

Spring MVC uses

Simple web-level unit testing, flexible URL-to-page controller mapping, flexible data validation formatting and data binding.

Spring MVC Architecture

This framework of MVC is based on the request-driven framework and is also used by the front-end controller pattern, which is distributed to the response controller according to the request mapping rules.

Spring MVC processing Request Flow
    1. First, the user sends a request-the front-end controller that determines the page controller based on the requested information, such as a URL.
    2. After the page controller receives the request, it processes the function and returns a Modelandview.
    3. The front controller reclaims control and renders according to the returned logical view.
    4. The front controller returns the response to the user.
Spring MVC Core Process
    1. First, the user sends the request-->dispatcherservlet, the front controller receives the request not to carry on the processing, but entrusts to the other parser to handle, as the unified access point, carries on the global flow control;

    2. Dispatcherservlet-->handlermapping, Handlermapping will map the request to the Handlerexecutionchain object (which contains multiple handlerinterceptor interceptors), and it is easy to add a new mapping strategy through this policy mode;

    3. The Dispatcherservlet-->handleradapter,handleradapter will package the processor as an adapter to support multiple types of processors, the adapter design mode application, which makes it easy to support many types of processors;

    4. Handleradapter--> Processor function Processing method call, Handleradapter will be based on the results of the adaptation to call the real processor function processing method, complete the function processing, and return a Modelandview object (including model data, logical view name);

    5. Modelandview logical View name---Viewresolver, Viewresolver will parse the logical view name into a specific view, through this strategy mode, it is easy to replace other view technology;

    6. view--> rendering, the view is rendered according to the model data passed in, the model is actually a map data structure, so it is easy to support other view technology;

    7. Returns control to Dispatcherservlet, which is returned by the Dispatcherservlet response to the user, to the end of this process.
      This section is from: The Tao Blog

Mostly recently in the making, so one side of the practice to try to write a reference. Write some more practical content in the back.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java Development-Spring MVC Learning

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.