Home » Java » A thorough interpretation of Spring, Framework, We...

A thorough interpretation of Spring, Framework, Web, MVC (first shot: Spring Web MVC)

Spring Web MVC brief introduction

Spring Web MVC (model view controller) framework is designed based on DispatcherServlet, which supports a configurable handler mapping, view analysis, localization, time and subject analysis and file upload function.DispatcherServlet will be responsible for distributing requests to different handler. can also create RESTful web sites and applications.


Spring data binding is quite flexible, for example, Spring can be a type mismatch as a validation application can identify errors, rather than system error. That is to say, spring can let us directly to the correct type parameter is bound to the business logic object.

The view of parsing Spring is quite flexible. The completion of a request, Controller is usually responsible for the preparation of a Map data model and select a specific view, of course, the direct write data stream is also supported. The analytical response of the view name is highly configurable, through the extension, accept header Content-Type. The bean name, property files or custom ViewResolver implementation to resolve. The model (Model), is a Map interface, provides complete abstraction of the view of the data, can be directly integrated, and rendering templates such as JSP, Velocity, Freemarker, or directly generate the original data, or XML, in response to JSON and other types of content. Model of Map interface is responsible for converting the data to the appropriate format, such as JSP Velocity model request attributes, such as.


Features of Spring, Web, MVC
A clear separation of roles: every role, such as controller, validator, command object, form object, model object, DispatcherServlet, handler mapping, view resolver, and so on, objects can be arbitrary.
The framework and application classes can be configured directly as JavaBean, which contain complex reference content, such as from web controllers to business objects and validation
Adaptation, no intrusion, freedom. You can define the method of any controller according to need, sign, use various annotations according to the scene used, such as @RequestParam, @RequestHeader, @PathVariable, and so on
Reusable business logic code
Custom bindings and validation
Custom handler, mapping, and view resolution., handler, mapping, and view resolution are configured based on URL
Flexible model conversion.Model conversion is accompanied by the name/value Map type, easy and arbitrary view technology integration
Custom locale, time, zone, and heme resolution
The powerful JSP tag library, the Spring tag library, supports data binding and topics
JSP's form tag library
The entire life cycle of the beans is contained in the current HTTP request or HTTP Session

Latest