The Tiles plugin allows actions to return Tiles pages.
- Supports Tiles in Freemarker, JSP, and Velocity
The following steps must be taken in order to enable tiles support within your Struts2 application:
- Include the struts-tiles-plugin as a dependency in your web application. If you are using maven2, the dependency configuration will be similar to:
- Register the tiles listener. This listener will typically either be the standard tiles listener (org.apache.tiles.listener.TilesListener) or the Struts2 replacement (org.apache.struts2.tiles.TilesListener). The latter provides tighter integration with Struts features such as freemarker integration.
- All package definitions which require tiles support must either extend the tiles-default package or must register the Tiles Result type definition.
- Configure your actions to utilize a tiles definition:
This example shows a Tiles layout page using Struts tags:
This plugin does inherits settings from Tiles configuration.
This plugin can be installed by copying the plugin jar into your application's
/WEB-INF/lib directory. No other files need to be copied or created.