我是新來的春天,並嘗試與春天使用瓷磚。但得到以上錯誤。我在我的項目中使用maven。我也嘗試過更改版本,但沒有用。以下是項目的內容:與彈簧瓷磚:獲取錯誤 - java.lang.ClassNotFoundException:org.apache.tiles.TilesApplicationContext
的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>
瓷磚-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>
然後有tilesMainTemplate,頁眉和頁腳jsp的,我不認爲有任何問題。在此方面的任何幫助將非常感謝,提前致謝。
這對我很有用 – 2016-07-08 02:39:42