- <Bean class="Org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name= "prefix" value="/web-inf/jsp/" />
- <property name="suffix" value= ". jsp" />
- </Bean>
In fact, Internalresourceviewresolver's work is very simple: in front of the view logical name plus prefix, followed by suffix;
- <Bean id= "myviewresolver" class=" Org.springframework.web.servlet.view.ResourceBundleViewResolver ">
- <property name="order" value="1"/>
- < name= "basename" value= "views "/>
- </Bean>
Because multiple Viewresolver can be configured, the above resolver also has an option order, which indicates the priority.
Through controller and direct access to JSP two kinds of
I want to put the JSP that the user can access directly under the/jsp/, and put the JSP that can be accessed by the controller under/web-inf/jsp/
Spring MVC uses a variety of viewresolver issues
<BeanID= "Velocityconfigurer"class= "Org.springframework.web.servlet.view.velocity.VelocityConfigurer"> < Propertyname= "Resourceloaderpath"value= "/web-inf/velo/"/> < Propertyname= "Velocityproperties"> <Props> <propKey= "Input.encoding">Utf-8</prop> <propKey= "Output.encoding">Utf-8</prop> </Props> </ Property> </Bean> <BeanID= "Viewresolver"class= "Org.springframework.web.servlet.view.velocity.VelocityViewResolver"> < Propertyname= "Cache"value= "false"/> < Propertyname= "prefix"value=""/> < Propertyname= "suffix"value= ". VM"/> < Propertyname= "ContentType"><value>Text/html;charset=utf-8</value></ Property> < Propertyname= "Exposespringmacrohelpers"value= "true"/> < Propertyname= "Order"><value>0</value></ Property> </Bean> <BeanID= "Jspviewresolver"class= "Org.springframework.web.servlet.view.InternalResourceViewResolver"> < Propertyname= "Cache"value= "false"/> < Propertyname= "prefix"value= "/web-inf/jsp/"/> < Propertyname= "suffix"value= ". jsp"/> < Propertyname= "ContentType"><value>Text/html;charset=utf-8</value></ Property> < Propertyname= "Order"><value>1</value></ Property> </Bean>
"Viewresolver" Springmvc JSP