首页 > 代码库 > Spring 3 MVC and Apache Tiles 3 Integration Error
Spring 3 MVC and Apache Tiles 3 Integration Error
<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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。