| < Day Day Up > |
|
Although the Tiles framework comes packaged with Struts, by default Tiles is not enabled. In order to enable and use Tiles, you have to add the following <plug-in> definition to your application's Struts configuration file:
<!-- Tiles Configuration --> <plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/> </plug-in>
This definition causes Struts to load and initialize the Tiles plugin for your application. Upon initialization, the plugin loads the comma-delimited list of Tiles configuration files specified by the 'definitions-config' property. Each configuration file's path must be specified using a Web application-relative path, as shown in the preceding example.
Note that your application's Struts configuration file must conform to the Struts configuration file DTD, which specifies the order in which elements are to appear in the file. Because of this, you must place the Tiles <plug-in> definition in the proper place in the file. The easiest way to ensure that you are properly ordering elements in the file is to use a tool, such as Struts Console, that automatically formats your configuration file so that it conforms to the DTD.
| < Day Day Up > |
|