,ch14.9433  Page 444  Monday, February 14, 2005  12:55 PM
With Tiles, you reduce the amount of HTML that you have to cut and paste. More
importantly, when you need to modify the layout for all pages, you only have to
make the change in one place. If you wanted to swap the position of the sidebars,
you could make the change in the layout JSP page and all the Tiles that use the corre 
sponding definition would reflect the new layout.
Tiles ships with Struts so no installation is required. To enable Tiles for your applica 
tion, do the following:
1. Place your Tiles definition file (tiles defs.xml) in your /WEB INF directory.
2. Add the Tiles plug in to your struts config.xml file, setting the definitions config
property appropriately:
                     value="/WEB INF/tiles defs.xml" />
See Also
The Struts User's Guide includes a section called  Page Composition with Tiles 
available at http://struts.apache.org/userGuide/building_view.html#Tiles.
Struts ships with a sample Tiles web application, tiles documentation.war. This appli 
cation includes the Tiles documentation and highlights the power of Tiles for com 
plex portal style applications.
Recipe 14.2 shows you how to create definitions by extending a base definition.
Instead of using a JSP to render a Tiles definition, such as the one shown in
Example 14 4, you can use the technique shown in Recipe 14.3.
Cedric Dumoulin, the creator of Tiles, has a number of resources, papers, and sample
code for Tiles. You can find these materials on his Tiles portal site at http://www.lifl.fr/
14.2 Extending Tile Definitions
You want to create a new Tiles definition that reuses a similar one.
When you define a new definition in your Tiles definition file (tiles def.xml), you can
specify a definition to extend using the
attribute. The new
definition inherits attributes of the extended definition and can override attribute
values. (See Example 14 5.)
444 | 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.






 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