http://webdownload.exadel.com/getfiles/jsf/examples/jsf-tiles.war (2.14M)
Then, all you have to do is add the struts.jar file from the Struts 1.1 distribution to your classpath. Including struts.jar does not mean that Struts itself is required to use JSF with Tiles. It's just that the Tiles packages are distributed inside the struts.jar file. No other functionality of the Struts Framework is involved.
Some Useful Tips
1. Here is the snippet from the web.xml file that enables Tiles:
- Code: Select all
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>TilesServet</servlet-name>
<servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
<init-param>
<param-name>definitions-config</param-name>
<param-value>/WEB-INF/tiles-defs.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
2. tiles-defs.xml is the standard name for a Tiles definitions file. However, you can call it anything you want and you can use more than one file. Use a comma-separated string to define such files for the definitions-config parameter in the web.xml file.
3. Use flush="false" for the tiles:insert tag is you use it inside an f:view element (between opening and closing f:view tags).
4. Use f:subview if you use tiles inside an f:facet element. For example:
- Code: Select all
<f:facet name="header">
<f:subview id="header">
<tiles:insert definition="page.header" flush="false"/>
</f:subview>
</f:facet>
5. Never include an f:view element inside another f:view element.
6. You cannot forward directly to the tiles, like in Struts. So, the JSF faces-config file should reference the pages using tiles as views.
7. Follow this online documentation: http://www.lifl.fr/~dumoulin/tiles/
8. For Exadel JSF Studio users, the jsf-tiles example is also available as a Exadel Studio project: http://webdownload.exadel.com/getfiles/jsf/examples/jsf-tiles.zip. Unzip it and import (File/Import/JSF Project) it into your Exadel Studio workspace.
