What you need to know about Spring MVC 4

Source: Internet
Author: User
Tags time zones

Spring MVC, also known as Spring Web MVC, is a mainstream web MVC framework, similar to the STRUTS2 framework, whose main purpose is to build a full-featured MVC module for WEB applications that maps between the view layer and the controller layer. Complete the data conversion between the view layer and the model layer.


The Spring MVC framework distributes request handlers through Dispatcherservlet, including configurable mappings, view solutions, languages, time zones, themes, and uploading files. The default processor is to handle various methods based on @Controller and @RequestMapping annotations. Starting with Spring 3.0, @Controller mechanism allows users to create RESTful Web sites and apps through @PathVariable annotations and other features.


One of the key principles of Spring WEB MVC is the openness to extensions, the closure of modifications, and the "open and closed principle" that we often say. So some of the methods in the Spring WEB MVC core class are marked as final types.

In Spring Web MVC, a user can use any object as a command or an object that is requested to access, without the need to implement an interface or base class for a particular framework framework. Spring's data binding mechanism is very flexible: for example, it can treat type-matching errors as validation error handling rather than system errors, so that the error type becomes an evaluated error. Although it is as simple as the properties of a business object that you do not need to duplicate, the untyped string in the form simply handles invalid commits, or converts the string to a legitimate type. However, it is usually a business object that can be directly bound.


Spring's solutions are often very flexible. The controller 's job is to select a view and map the data to that view, and of course the controller can write the output stream directly to complete the request. The view mechanism is highly configurable through the file extension, the Accept header type, the bean name, the properties file, and the custom Viewresolver implementation. The model in MVC is the Map interface, which allows for a complete abstraction of the view technology that can be integrated with template-based rendering techniques such as jsp,velocity and Freemarker, as well as XML, JSON, Atom, and other types of content. The MAP model can easily be converted into other formats, such as JSP request properties, velocity template model.


Spring MVC 4 Features:

    1. role separation: Controller , validator, Command object, Form object, model object, Dispatherservlet, handler mapping, view resolver, etc. can all be implemented separately.

    2. powerful simple configuration framework and application class as JavaBeans: Configuration includes simple context references, For example, a web front-end controller references a business object and a validator.

    3. adaptability, flexibility, non-intrusive: can be used such as @requestparam, @RequestHeader, @ Annotations such as Pathvariable define the method signature of any controller.

    4. Reusable business code: Use the existing Business object as command object or Form object instead of the base class of the inheritance framework as mirroring.

    5. Customizable binding and validation mechanisms: Type mismatch as an application-level validation error, use of pass-through values, localized date and data binding overrides will manually convert the object to a string or to a business object.

    6. Customizable handler mappings and view mechanisms. Handler mapping and view mechanisms can be handled from simple URL configurations to complex, specialized resolution strategies.

    7. Flexible model transfer mechanism: it is easy to integrate with other view technologies using model transfer mechanisms such as Key/value in map.

    8. Supports internationalization, supports time zones, supports themes, supports JSPS, supports JSTL, supports velocity, and more. The

    9. JSP Tag Library, also known as the Spring Tag library, supports data binding and themes.


With respect to spring MVC, developers use most of their dispatcherservlet forwarding, configuring forwarding paths through annotation @controller, and returning views through Modelandview, which is the main content of Web MVC. Spring MVC has a different version of the content, learned a version of the use of other versions will be used.




This article is from the "Dust Wind with the Sky" blog, please be sure to keep this source http://favccxx.blog.51cto.com/2890523/1576352

What you need to know about Spring MVC 4

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.