Springmvc-servlet.xml Configuration
<!--Velocity - <BeanID= "Velocityviewresolver"class= "Org.springframework.web.servlet.view.velocity.VelocityViewResolver"> < Propertyname= "Order"value= "0" /> < Propertyname= "ContentType"value= "Text/html;charset=utf-8" /> < Propertyname= "Requestcontextattribute"value= "req"/> </Bean> <!--Velocity - <BeanID= "Velocityconfig"class= "Org.springframework.web.servlet.view.velocity.VelocityConfigurer"> < Propertyname= "Configlocation"value= "/web-inf/velocity.properties"/> < Propertyname= "Resourceloaderpath"value="/" /> </Bean> <!--Freemarker - <BeanID= "Freemarkerviewresolver"class= "Org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> < Propertyname= "Order"value= "0" /> < Propertyname= "Viewclass"value= "Org.springframework.web.servlet.view.freemarker.FreeMarkerView"/> </Bean> <!--Freemarker - <BeanID= "Freemarkerconfig"class= "Org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> < Propertyname= "Configlocation"value= "/web-inf/freemarker.properties"/> < Propertyname= "Templateloaderpath"value= "/web-inf/ftl/"/> < Propertyname= "Freemarkervariables"> <Map> <entryKey= "Xml_escape"Value-ref= "Fmxmlescape"/> </Map> </ Property> </Bean> <BeanID= "Fmxmlescape"class= "Freemarker.template.utility.XmlEscape"/>
<BeanID= "Tilesviewresolver"class= "Org.springframework.web.servlet.view.UrlBasedViewResolver"> < Propertyname= "Viewclass"value= "Org.springframework.web.servlet.view.tiles3.TilesView"></ Property> < Propertyname= "Order"value= "1" /> </Bean> <BeanID= "Tilesconfigurer"class= "Org.springframework.web.servlet.view.tiles3.TilesConfigurer"> < Propertyname= "Definitions"> <List> <value>Classpath:layout.xml</value> </List> </ Property> </Bean><!--define the location of the JSP file - <BeanID= "Viewresolver"class= "Org.springframework.web.servlet.view.InternalResourceViewResolver">< Propertyname= "prefix"value= "/web-inf/pages/"/> < Propertyname= "suffix"value= ". jsp"/> < Propertyname= "Order"value= "1" /> </Bean>
Note: Key <property name= "order" value= "1"/> configuration 0,1,2,3,4,5,6 ... first parse from 0, then down, JSP must be put to the last, otherwise find return page directly back to 404 page
, will not go to other page matching, or the JSP order to the highest, this is a pit, or write the parser to parse. It's so easy.
Springmvc Configuring multiple views, returning Jsp,velocity,freemarker,tiles (templates), and so on