,ch14.9433 Page 456 Monday, February 14, 2005 12:55 PM
The paths used in a Tiles definition file are treated as context relative
even if that definition is used for a specific module.
See Also
This topic has been discussed on the struts user mailing list. One particular thread
you may find helpful is archived at http://marc.theaimsgroup.com/?l=struts
user&m=109579114312336&w=2.
If you are unfamiliar with Struts modules, see Recipe 2.5.
14.7 Reusing a Common Page Layout
with SiteMesh
Problem
You want render your application's pages using a common layout without having to
change your JSP pages or your application's Struts configuration.
Solution
Use SiteMesh to wrap your application's pages with a common layout and other pre
sentation features.
Discussion
SiteMesh (http://www.opensymphony.com/sitemesh/) is a web page layout and deco
ration framework. It allows you to decorate the web pages of an existing application
with a common layout. It provides similar features as Tiles but uses a completely dif
ferent approach. When you use Tiles, you adopt the Tiles way of doing things by
constructing pages using Tiles custom JSP tags, creating definitions in a Tiles config
uration file, and linking actions to Tiles using the
TilesRequestProcessor
. Tiles
becomes a pervasive part of your web application.
SiteMesh takes a different approach. It uses a servlet filter to modify the HTTP
responses generated by your application, with responses typically generated by JSP
pages. SiteMesh amends the response based on settings in a configuration file.
Suppose you have a site with three web pages: a main page, and two secondary
pages. The main page looks something like Figure 14 5.
The secondary pages referred to by the two hyperlinks are, like this page, simple.
The struts config.xml file for this application is shown in Example 14 13.
456 | Chapter 14: Tiles and Other Presentation Approaches
This is the Title of the Book, eMatter Edition
Copyright 2005 O'Reilly & Associates, Inc. All rights reserved.
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved