Project Retired
Project is retired. See https://attic.apache.org/projects/tiles.html
<context-param> <description>Tiles configuration file</description> <param-name> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG </param-name> <param-value>/WEB-INF/classes/tiles.xml, /WEB-INF/tiles.xml</param-value> </context-param> <servlet> <servlet-name>tiles</servlet-name> <servlet-class> org.apache.tiles.web.startup.TilesServlet </servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>tiles_dispatch</servlet-name> <servlet-class> org.apache.tiles.web.util.TilesDispatchServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>tiles_dispatch</servlet-name> <url-pattern>*.tiles</url-pattern> </servlet-mapping>
Place Tiles configuration to /WEB-INF or /WEB-INF/classes.
tiles.xml example:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> <tiles-definitions> <definition name="test" template="index.jsp"> </definition> </tiles-definitions>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Test page</title> </head> <body> <h3>Success...</h3> </body> </html>
Copy Tiles libraries to WEB-INF/lib (tiles-.jar and common-.jar).
Run web application in web container (like Tomcat) and navigate url http://localhost:8080/mywebapp/test.tiles