,ch14.9433 Page 446 Monday, February 14, 2005 12:55 PM
To create a page that uses the new definition, you insert the definition using the tiles:
insert JSP tag as shown by Example 14 6 (startPage.jsp).
Example 14 6. JSP that references a definition extension
<%@ taglib uri="http://struts.apache.org/tags tiles" prefix="tiles" %>
You can bypass the trivial JSP page used in Example 14 6 by forwarding directly to a
definition, as shown in Recipe 14.3.
14.3 Displaying Tiles Using a Struts Forward
You don't like having to write and maintain minimal JSP pages that insert a Tiles
Use action forwards in your struts config.xml file that specify the definition name for
attribute on the
behind the scenes by the
, will forward to the definition as if it were
inserted by a JSP.
Assuming Tiles definitions are in your tiles defs.xml file named
, you can create actions such as the following in your struts config.
If you've read over the first couple of Tiles recipes, you'll notice that once a definition
is created, its trivial to write JSP code to render the page. Tiles uses a custom request
processor to eliminate the need for these trivial pages. The
when the plug in initializes. The
vides special handling that allows you to use a Tiles definition as the target path for a
Struts forward. When the
processes the forward, if the forward
path matches a Tiles definition name, it loads the definition, creates and initializes the
446 | 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.