Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

This plugin was dropped in Struts 2.5, instead please use Tiles Plugin which was extended and upgraded to Tiles 3.

Info

Tiles is a templating framework designed to easily allow the creation of web application pages with a consistent look and feel. It can be used for both page decorating and componentization. This is the first release of the plugin!

...

The following steps must be taken in order to enable Tiles 3 support within your Struts2 application:

  1. Include the struts-tiles3-plugin as a dependency in your web application, do not include the old struts2-tiles-plugin! If you are using maven3, the dependency configuration will be similar to:

    Code Block
    xml
    xml
    
    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-tiles3-plugin</artifactId>
      <version>${version.tiles}</version>
      <scope>compile</scope>
    </dependency>
    
  2. Register the tiles listener.

    Code Block
    xml
    xml
    
    <listener>
        <listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
    </listener>
    
  3. All package definitions which require tiles support must either extend the tiles-default package or must register the Tiles 3 Result type definition.

    Code Block
    xml
    xml
    
    <result-types>
      <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
    </result-types>
    
  4. Configure your actions to utilize a tiles definition:

    Code Block
    xml
    xml
    
    <action name="sample" class="org.apache.struts2.tiles.example.SampleAction" >
      <result name="success" type="tiles">tilesWorks</result>
    </action>
    

...