SPRINGMVC Series (vii) View parsers and views

Source: Internet
Author: User

Configure the view resolver inside the Springmvc.xml
1 <!--Configure the View resolver: How to resolve the handler method return value to the actual physical view -2     <Beanclass= "Org.springframework.web.servlet.view.InternalResourceViewResolver">3         < Propertyname= "prefix"value= "/web-inf/views/"></ Property>4         < Propertyname= "suffix"value= ". jsp"></ Property>5     </Bean>

The process by which Spring MVC transforms a logical view into a physical view

? When the request processing method finishes executing, a Modelandview object is returned. For those processing methods that return types such as String,view or Modemap, Spring MVC also assembles them internally into a Modelandview object that contains a view of the logical names and model objects

? Spring MVC uses the View parser (Viewresolver) to get the final view object (view), which can be either a JSP or a view of various representations, such as Excel, Jfreechart, etc.

? The processor is not concerned about what view objects are ultimately being taken to render the model data, and the processor focuses on the work of the production model data to fully decouple the MVC

Second, view parser

? SPRINGMVC provides different strategies for parsing logical view names, configuring one or more parsing strategies in the Spring WEB context, and specifying their sequencing. Each mapping strategy corresponds to a specific view resolver implementation class.

? The view parser has a single function: parsing a logical view into a specific view object.

? All view parsers must implement the Viewresolver interface:

Third, view

? The purpose of the view is to render the model data and present the data in the model to the customer in some form.

? In order to decouple the view model and the implementation technology, Spring defines a highly abstract view in the Org.springframework.web.servlet package.

Interface:

? The View object is instantiated by the view resolver. Because views are stateless, they do not have thread security issues

SPRINGMVC Series (vii) View parsers and views

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.