Installing and Configuring Tiles

Before you can use the Tiles framework, you must ensure that it’s installed and properly configured within your web container. The Tiles framework is not dependent on any specific container. You will need to obtain the required files and ensure that they are placed into their proper directories within the web application.

Downloading Tiles

The Tiles framework is included with the Struts distribution. It previously was included in the contrib folder, but it is now part of the core distribution. You also can find the latest source and binary distribution, as well as other useful information, at http://www.lifl.fr/~dumoulin/tiles/index.html.

Installing the Required JARs and Misc Files

With earlier versions of Struts and Tiles, each was contained within its own JAR file. With Struts 1.1, Tiles components have now been integrated into struts.jar. As with all other things Struts, you will also need the standard commons JAR files installed in the WEB-INF/lib directory.

You will also need to install the Tiles TLD file, struts-tiles.tld, in the WEB-INF directory for the application.

Warning

Don’t add the struts.jar file to the classpath of your servlet container in an attempt to avoid placing it in the WEB-INF/lib directory of each individual web application. Doing so may cause ClassNotFoundExceptions to be thrown.

You should put the tiles-config_1_1.dtd file in the WEB-INF directory, too. This DTD is used to validate Tiles definition files, which we’ll discuss ...

Get Programming Jakarta Struts, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.