SPRINGMVC Framework and basic work flow

Source: Internet
Author: User

Traditional native Jsp+servlet in the process of development, although simple and clear, JSP page transfer data to Servlet,servlet collation data (logic development) or extract data from the database and then forwarded to the JSP page, but it seems to only stop here, We all know that our request and response depend on the URL, and when we want to do it by programming around URLs, pure Jsp+servlet only works on the implementation of filter filters before arriving at the corresponding servlet, But what if we want to do some work after the servlet forwards or redirects? A URL corresponding to a servlet, the URL of the project needs a little more complex, its corresponding servlet number will be very large, many problems, here is not much to say, and these problems, basically in the SPRINGMVC to solve.

Springmvc around the servlet for the development of the web, the implementation of the code is also dependent on spring development, or is not called SPRINGMVC, the emphasis of this article is focused on SPRINGMVC workflow, do not design specific code development, So don't ask for knowledge of spring

1. Starting from the 1th, the request is of course the source of the user access to the URL, after Springmvc's work formally began, like a person into the city, must go through the gate before entering, the request is the same, he must go through a front controller called dispatcher servlet,

2. After that, you always have to have a work place (request need to work), but do not recognize the road AH (where the request needs to be analyzed), so you need to find the map, and then find the location on the map, in Springmvc, from the dispatcher servlet first to find handler Mapper, the component maps to find the boss of the work Point (Handleradapter).

3. Here we just know how to find a working point, and the path starts with the gate (Dispatcher servlet Front Controller), We found the handleradapter that instructed us to work according to the guidance of the map (the information in the Handlermapper component).

4. The boss directs us to work, at this time we incarnate as an employee (Handler, that is, the request corresponds to the event), the content of our work on the control layer (that is, C in MVC) The corresponding method of the request URL, after the completion of the work, We need to submit work data to the boss to see (Return Modelandview object to Handleradapter)

5. The boss then puts your work data on the gate (returning the Modelandview object to Dispatcherservlet) and then presents it to the merchant (user) after a modification.

A general view of the basic process is probably the case, however, springmvc in concrete implementation is far more complex than this, basically in general project development under the configuration of SPRINGMVC requirements of the environment, we need to develop only the view layer and the control layer, The code inside the control layer is usually implemented with a logical layer and a data layer.

Here is the process I made with mind mapping, which is more intuitive than text.

  

SPRINGMVC Framework and basic work flow

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.