Spring MVC Tutorial

Source: Internet
Author: User
Tags spring mvc tutorial

Spring MVC is a model-view-controller (MVC) Web framework built on the central front-end controller servlet (Dispatcherservlet), which is responsible for sending each request to the appropriate handler, using the view to ultimately return the concept of the response result. Spring MVC is part of the spring product portfolio, which has the spring IOC container tightly coupled with spring loose coupling, so it has all the benefits of spring.

Springmvc as shown in the architecture diagram

Spring WEB MVC Framework Features

Clear role Partitioning: Controller, Validator (validator), Command object, Form objects (Form object), model object (models), The servlet Dispatcher (Dispatcherservlet), the processor mapping (handler mapping), the view resolver, and so on. Each role can be implemented by a dedicated object.

Powerful and straightforward configuration: both the Framework class and the application class can be configured as JavaBean, supporting references across multiple context, such as references to business objects and validators (validator) in the Web controller.

Adaptable, non-intrusive: Depending on the application scenario, you can select the appropriate controller subclass (simple, command, form, Wizard, Multi-Action, or custom), rather than from a single control (such as the action/- Actionform) inheritance.

Reusable business code: You can use an existing business object as a command or Form object without having to extend the base class of a particular framework.

Customizable bindings (binding) and Validation (validation): For example, type mismatch as an application-level validation error, which can hold the wrong value. such as localized date and number bindings and so on.

Customizable handler mapping and view resolution:spring provide the simplest URL mapping to complex, dedicated customization strategies.

Flexible model conversions: In the Springweb framework, map-based key/value pairs are used to easily integrate with various view technologies.

Customizable localization and theme (theme) parsing: supports the optional use of the Spring tag library in JSPs, support for jstl, support for velocity (no additional middle tier), and more.

Simple and powerful JSP tag library: Support includes many features such as data binding and themes (theme). It provides maximum flexibility in terms of marking.

JSP Form Tag library: The form tag Library introduced in Spring2.0 makes it easier to write forms in JSP.

The life cycle of the Spring bean can be limited to the current HTTP request or HTTP Session. To be precise, this is not the Spring MVC framework itself but belongs to the Webapplicationcontext container used by sping MVC.

The approximate execution process for Spring MVC is as follows:

1, the first browser to send a request to the front-end controller Dispatcherservlet,dispatcherserlvet according to the request information, based on a certain principle to choose the appropriate controller to process and delegate the request to it.

2, the page controller after receiving a request for functional processing, first need to collect, bind the request parameters to an object (Command object), and verify, and then delegate the object to the business object for processing (service layer); After the business object is processed, the controller returns a Modelandview ( Model data and logical view names);

3, Dispatcherservlet according to the return of the logical view name, select the appropriate view for rendering (interface display, resource loading), and the model data passed in so that the view rendering.

4. The front controller returns a response to the client browser.

Spring MVC Tutorial

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.