Spring Web MVC Basics

Source: Internet
Author: User

1. Introduction to the MVC pattern

M-model model

The role of model is to be responsible for business logic. Consists of two tiers: business data and business processing logic. For example, entity class, DAO, service all belong to model layer.

V-view View

The view's responsibility is to display the interface and user interaction (mobile user information). A component that belongs to a view is a JSP that does not contain business logic and control logic

C-controller Controller

A controller is a bridge between the model layer m and the view layer V for controlling processes such as:

A single controller Actionservlet in a servlet project.

2. What is Spring Web MVC

Spring Web MVC is a very important functional module of the spring Framework. The MVC structure is implemented to facilitate the simple and rapid development of the MVC structure of the Web program. The API provided by Spring Web MVC encapsulates the functionality of web development and simplifies the web process.

3. Core components of Spring WEB MVC

Spring WEB MVC provides the main implementation components related to M, V, and C, as follows:

Dispatcherservlet (Controller, request entry)

Handlermapping (Controller, request dispatch)

Controller (Director, request processing process)

Modelandview (model, encapsulating Business processing results and views)

Viewresolver (view, view display processor)

4. Spring Web MVC Processing flow

The browser sends a request to spring and requests it to the front-end controller Dispatcherservlet processing

The controller uses handlermapping to find the appropriate controller component to process the request

The Execute Controller component contract method processes the request, and the contract method invokes the model component to complete the business processing. The contract method can return a Modelandview object that encapsulates the processing result data and the view name information

After the controller accepts Modelandview, it calls the Viewresoler component, locates the view (JSP) and passes the data information to generate the response interface result

5.

Spring Web MVC Basics

Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

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.