问题
I have successfully integrated Apache Tiles with my webstore which is built on pure JSP and Servlet technology (Tomcat 8). I am using Apache Tiles only and only for page templating, nothing else and my maven pom includes the dependency as follows:
pom.xml
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>3.0.5</version>
</dependency>
I have the feeling that tiles-extras
pulls in everything that I may not even be using. My question is which specific jar should I include for templating? I am using a template.jsp
which acts as the base JSP template page which looks as follows:
template.jsp
<body>
<table class="noborder">
<tr>
<td>
<tiles:insertAttribute name="header"/>
<tiles:insertAttribute name="body"/><br/><br/>
<tiles:insertAttribute name="footer"/>
</td>
</tr>
</table>
</body>
WEB-INF/tiles.xml
<tiles-definitions>
<definition name="homePage" template="/jsp/template.jsp">
<put-attribute name="header" value="/jsp/header/header.jsp" />
<put-attribute name="body" value="/jsp/content/home/home.jsp" />
<put-attribute name="footer" value="/jsp/footer/footer.jsp" />
</definition>
web.xml
<listener>
<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
</listener>
<servlet>
<servlet-name>Tiles Dispatch Servlet</servlet-name>
<servlet-class>org.apache.tiles.web.util.TilesDispatchServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Tiles Dispatch Servlet</servlet-name>
<url-pattern>*.tiles</url-pattern>
</servlet-mapping>
回答1:
If you not use the tiles-extra tags add only tiles-jsp
来源:https://stackoverflow.com/questions/29808419/apache-tiles-integration-with-jsp-and-servlet-webapp