Java,Spring 3.0.5与Apache tiles 2.2.2集成

时间:2011-08-10 14:02:30

标签: java spring spring-mvc apache-tiles

遵循本教程: http://viralpatel.net/blogs/2010/07/spring-3-mvc-tiles-plugin-tutorial-example-eclipse.html

Tiles配置(tiles.xml):

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
       "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
    <definition name="base.definition"
        template="/WEB-INF/jsp/layout.jsp">
        <put-attribute name="title" value="" />
        <put-attribute name="header" value="/WEB-INF/jsp/header.jsp" />
        <put-attribute name="menu" value="/WEB-INF/jsp/menu.jsp" />
        <put-attribute name="body" value="" />
        <put-attribute name="footer" value="/WEB-INF/jsp/footer.jsp" />
    </definition>

    <definition name="contact" extends="base.definition">
        <put-attribute name="title" value="Contact Manager" />
        <put-attribute name="body" value="/WEB-INF/jsp/contact.jsp" />
    </definition>

</tiles-definitions>

弹簧servlet.xml中

<context:component-scan base-package="hello.spring3.controller" />

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass" 
        value="org.springframework.web.servlet.view.tiles2.TilesView"/>
    <property name="prefix" value="/WEB-INF/jsp/"/>
    <property name="suffix" value=".jsp" />
</bean>

<bean id="tilesConfigurer"
    class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/tiles.xml</value>
        </list>
    </property>
</bean>

当我运行它时,我收到错误: http://pastebin.com/KY541YKD

可能是什么问题?如果您对其他文件/配置有任何疑问,请问我

1 个答案:

答案 0 :(得分:1)

从你的错误:

java.lang.NoClassDefFoundError: org/apache/commons/digester/Rule

看起来你错过了commons-digester之前的3.0版本。