标签:style blog http ar io color sp java on
<bean id="viewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"> <property name="viewClass"> <value> org.springframework.web.servlet.view.tiles3.TilesView </value> </property> </bean> <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/conf/tiles.xml</value> </list> </property> </bean>
注意如果报 java.lang.NoClassDefFoundError: org/apache/tiles/startup/BasicTilesInitializer
说明你的配置错了,Tiles2对应Tiles2的View和configure, 而Tiles3对应3的View和configure, 所以相应的节点都要改为对应版本的值
还有在tiles.xml文件配置中 DTD类型也要对应的改掉, 如下:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_3_0.dtd"> <tiles-definitions> <definition name="base.definition" template="/WEB-INF/views/share/layout.jsp"> <put-attribute name="title" value="" /> <put-attribute name="header" value="/WEB-INF/views/share/header.jsp" /> <put-attribute name="body" value="" /> <put-attribute name="footer" value="/WEB-INF/views/share/footer.jsp" /> </definition> <definition name="test/helloworld" extends="base.definition"> <put-attribute name="title" value="helloworld" /> <put-attribute name="body" value="/WEB-INF/views/test/helloworld.jsp" /> </definition> </tiles-definitions>
Spring 3 MVC and Apache Tiles 3 Integration Error
标签:style blog http ar io color sp java on
原文地址:http://www.cnblogs.com/stevenx1987/p/4171028.html