Project Documentation

Description

For better struts/tiles support, MyFaces has an integrated JspTilesViewHandler (since release 1.0.6 beta). The main advantage of the ViewHandler is, that tiles-definitions can be sourced out into xml files (up to now using tiles and myfaces you had to definie the layout within jsp-pages).

Take a look at the myfaces-tiles-example web application.

Screen Shot

Not Available

API

Not Applicable

Syntax

Not Applicable

Instructions

  1. Configure the JspTilesViewHandler in your faces-config:
    <application>
        <view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>
    </application>
                        
  2. Add the following lines to your web.xml:
    <context-param>
        <param-name>tiles-definitions</param-name>
        <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>
                        
  3. Define your layout in a tiles-definition file

When rendering the view, the JspTilesViewHandlerImpl will take the given viewId and compute a tileId by:

  • Substituting any extension by ".tiles"
  • Appending ".tiles" if path-mapping is used

Next the ViewHandler looks up in the tile-definitions for the corresponding definition. (eg. for viewId = /page1.jsp the lookup would be /page1.tiles)