Quick Install
-
Create a new web application based on the Struts Blank example.
-
Edit the struts-config and uncomment the section that refers
to the "Tiles PlugIn".
-
Create one or more Tiles Definitions XML files in the /WEB-INF
directory of the new application.
-
Deploy the new application.
Configuring the Plugin
Here's how to use Tiles in your own application:
-
Ensure that a
struts-tiles.jar is available in
the WEB-INF/lib directory of your web application.
-
Add this
init-param to the Action
Servlet definition in web.xml:
<init-param>
<param-name>chainConfig</param-name>
<param-value>org/apache/struts/tiles/chain-config.xml</param-value>
</init-param>
-
Configure the Tiles Plugin to load your definitions.
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property
property="definitions-config"
value="/WEB-INF/tiles-defs.xml"/>
</plug-in>
-
At the top of each JSP page that will use the Tiles custom tags,
add a line that declares the Tiles custom tag library.
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
Avoiding ClassNotFoundExceptions
WARNING - Do
NOT add
tiles.jar to the classpath of your servlet container in
an attempt to avoid placing it in the
/WEB-INF/lib
directory of each individual web app! Doing so will cause problems with
ClassNotFoundException exceptions.
For most containers, you need only to:
- Copy the WAR files in your Tiles
/webapp directory
to your containers webapps directory.
- In some cases, you may need to restart your container if it
is running.