弹簧砖:出现错误-java.lang.ClassNotFoundException:org.apache.tiles.TilesApplicationContext [英] tiles with spring : getting error - java.lang.ClassNotFoundException: org.apache.tiles.TilesApplicationContext
问题描述
我是Spring的新手,并尝试在Spring中使用磁贴.但是遇到了错误.我在我的项目中使用Maven.我也尝试过更改版本,但没有用.以下是项目的内容:
I am new to spring and trying to use tiles with Spring. but getting above error. i am using maven in my project. i tried changing versions also, but no use. following are contents of project:
pom.xml
<!-- Apache Tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-template</artifactId>
<version>3.0.5</version>
</dependency>
servlet-context.xml
<!-- for Tiles -->
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" id="viewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</bean>
<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" id="tilesConfigurer">
<property name="definitions" value="/WEB-INF/tiles-definitions.xml" />
</bean>
tiles-definitions.xml
<?xml version="1.0" encoding="UTF-8"?>
<tiles-definitions>
<definition name="base.definition" template="/WEB-INF/views/tilesMainTemplate.jsp">
<put-attribute name="title" value=""></put-attribute>
<put-attribute name="header" value="/WEB-INF/views/header.jsp"></put-attribute>
<put-attribute name="menu" value="/WEB-INF/views/home.jsp"></put-attribute>
<put-attribute name="body" value=""></put-attribute>
<put-attribute name="footer" value="/WEB-INF/views/footer.jsp"></put-attribute>
</definition>
<definition extends="base.definition" name="saveAd">
<put-attribute name="title" value="Post your free Ad"></put-attribute>
<put-attribute name="body" value="/WEB-INF/views/adSave.jsp"></put-attribute>
</definition>
</tiles-definitions>
然后有tileMainTemplate,页眉和页脚jsp,我认为它们没有任何问题.在此方面的任何帮助将不胜感激,谢谢.
then there are tilesMainTemplate, header and footer jsp's which i dont think have any issues. any help in this regard will be highly appreciated, Thanks in advance.
推荐答案
终于成功了!如mck所正确指出的,我用tile3替换了tile2,并在 tiles-definitions.xml
Finally it worked ! I replaced tiles2 by tiles3 as correctly pointed out by mck and added following line to tiles-definitions.xml
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
这篇关于弹簧砖:出现错误-java.lang.ClassNotFoundException:org.apache.tiles.TilesApplicationContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!