I successfully integrated Apache Tiles with my online store, which is built on pure JSP and Servlet technologies (Tomcat 8). I use only Apache Tiles and only for page templates, nothing else, and my maven mom 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 into everything that I canβt even use. My question is which specific jar should be included for templates? I am using template.jsp , which acts like the base page of a JSP template, which looks like this:
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>
source share