You want render your application's pages using a common layout without having to change your JSP pages or your application's Struts configuration.
Use SiteMesh to wrap your application's pages with a common layout and other presentation features.
SiteMesh (http://www.opensymphony.com/sitemesh/) is a
web-page layout and decoration 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 different
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 configuration file, and linking actions to
Tiles using the
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.
Figure 14-5. Page slated for decoration by SiteMesh
The secondary pages referred to by the two hyperlinks are, like this page, simple. The struts-config.xml file for this ...