Skip to content

Instantly share code, notes, and snippets.

@solo-seven
Created October 11, 2011 13:31
Show Gist options
  • Save solo-seven/1278083 to your computer and use it in GitHub Desktop.
Save solo-seven/1278083 to your computer and use it in GitHub Desktop.
Sample tiles setup
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<table>
<tr>
<td colspan="2">
<tiles:insertAttribute name="header" />
</td>
</tr>
<tr>
<td>
<tiles:insertAttribute name="menu" />
</td>
<td>
<tiles:insertAttribute name="body" />
</td>
</tr>
<tr>
<td colspan="2">
<tiles:insertAttribute name="footer" />
</td>
</tr>
</table>
.
├── index.jsp
├── layouts
│   └── classic.jsp
├── META-INF
│   └── MANIFEST.MF
├── tiles
│   ├── banner.jsp
│   ├── common_menu.jsp
│   ├── credits.jsp
│   └── home_body.jsp
└── WEB-INF
├── classes
├── lib
│   ├── aopalliance-1.0.jar
│   ├── commons-beanutils-1.8.0.jar
│   ├── commons-collections-3.2.jar
│   ├── commons-digester-2.0.jar
│   ├── commons-lang-2.4.jar
│   ├── freemarker-2.3.15.jar
│   ├── javassist-3.7.ga.jar
│   ├── mvel2-2.0.11.jar
│   ├── ognl-2.7.3.jar
│   ├── oro-2.0.8.jar
│   ├── spring-beans-2.5.6.jar
│   ├── spring-context-2.5.6.jar
│   ├── spring-core-2.5.6.jar
│   ├── spring-web-2.5.6.jar
│   ├── tiles-api-2.2.2.jar
│   ├── tiles-compat-2.2.2.jar
│   ├── tiles-core-2.2.2.jar
│   ├── tiles-el-2.2.2.jar
│   ├── tiles-extras-2.2.2.jar
│   ├── tiles-freemarker-2.2.2.jar
│   ├── tiles-jsp-2.2.2.jar
│   ├── tiles-mvel-2.2.2.jar
│   ├── tiles-ognl-2.2.2.jar
│   ├── tiles-servlet-2.2.2.jar
│   ├── tiles-servlet-wildcard-2.2.2.jar
│   ├── tiles-template-2.2.2.jar
│   ├── tiles-velocity-2.2.2.jar
│   ├── velocity-1.6.2.jar
│   └── velocity-tools-2.0.jar
├── tiles.xml
└── web.xml
6 directories, 38 files
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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="myapp.homepage" template="/layouts/classic.jsp">
<put-attribute name="title" value="Tiles tutorial homepage" />
<put-attribute name="header" value="/tiles/banner.jsp" />
<put-attribute name="menu" value="/tiles/common_menu.jsp" />
<put-attribute name="body" value="/tiles/home_body.jsp" />
<put-attribute name="footer" value="/tiles/credits.jsp" />
</definition>
</tiles-definitions>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>struts-test</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>tiles</servlet-name>
<servlet-class>org.apache.tiles.web.startup.simple.SimpleTilesInitializerServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment