,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" %>
See Also
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
Problem
You don't like having to write and maintain minimal JSP pages that insert a Tiles
definition.
Solution
Use action forwards in your struts config.xml file that specify the definition name for
the
path
attribute on the
forward
element. The
TilesRequestProcessor
, deployed
behind the scenes by the
TilePlugin
, will forward to the definition as if it were
inserted by a JSP.
Assuming Tiles definitions are in your tiles defs.xml file named
.someTilesDef
and
.anotherTilesDef
, you can create actions such as the following in your struts config.
xml file:
     forward=".someTilesDef"/>
        type="com.foo.SomeAction">
    
Discussion
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
TilesPlugin
installs the
TilesRequestProcessor
when the plug in initializes. The
TilesRequestProcessor
pro 
vides special handling that allows you to use a Tiles definition as the target path for a
Struts forward. When the
TileRequestProcessor
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.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

strutsweb hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved