Modelandview
1.Model (model)
The essence of 1.model is hashmap, adding data to the model, that is, adding data to the HashMap.
2.HashMap is a one-way lookup array, one-way linked list array
3.LinkedHashMap, essentially a hashmap, but it expands the entry and turns it into a two-way
2.View (view)
Modelandview internally by Setviewname () to specify the view name
This view name corresponds to a View object, which is encapsulated in Modelandview and passed to the view parser to parse
View Resolver Viewresolver
Attempting to parse the Viewresolver interface is responsible for generating the view view of the processing results, there are four common implementation classes
(1) Internalresourceviewresolver view parser (default)
This view resolver is used to encapsulate and jump through the internal resources of the current web app (you can choose whether to stitch Web resource names)
For internal resource definitions, you can define only one format resource: A resource file of the same file type that resides in the same directory
(2) Beannameviewreolver View parser (can be turned to external resources)
Multiple view-view beans can be defined, allowing Modelandview in the processor to pass a reference to the ID of these beans to complete the jump to the encapsulated resource in the view
1 <Beanclass= "Org.springframework.web.servlet.view.BeanNameViewResolver"/>2 3 <!--define multiple View-view beans to allow Modelandview in the processor to complete a jump to the encapsulated resource in View by referencing the Bean's ID -4 <!--define an external resource View object -5 <BeanID= "Taobao"class= "Org.springframework.web.servlet.view.RedirectView">6 < Propertyname= "url"value= "Http://www.taobao.com"/>7 </Bean>8 9 <!--define an external resource View object -Ten <BeanID= "Baidu"class= "Org.springframework.web.servlet.view.RedirectView"> One < Propertyname= "url"value= "Http://www.baidu.com"/> A </Bean> - - <!--define an internal resource View object - the <BeanID= "Myinternalview"class= "Org.springframework.web.servlet.view.JstlView"> - < Propertyname= "url"value= "/web-inf/jsp/hello.jsp"/> - </Bean> - + - <BeanID= "/hello.do"class= "Com.springmvc.handlers.MyController"/> + A at - </Beans>
3.XmlViewResolver View Parser and Resourcebundleviewresolver view parser
When you need to define a lot of view objects, you make the Springmvc.xml file large,
So you can extract these view objects specifically to define an XML or resource file for unified management
The priority of the view parser
The view parser has an order property that is designed to prioritize multiple view parsers. The smaller the number, the higher the priority, the same number, the higher priority for registering first
1 <Beanclass= "Org.springframework.web.servlet.view.XmlViewResolver">2 < Propertyname= "Location"value= "Classpath:myViews.xml"></ Property>3 < Propertyname= "Order"value= "1"></ Property>4 </Bean>
7.SpringMVC Profile Development-modelandview and view resolver