,ch14.9433 Page 445 Monday, February 14, 2005 12:55 PM
Example 14 5. Extending a new definition from a base definition
" //Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/tiles config_1_1.dtd">
Discussion
With Tiles, you can base a Tile definition on the definition of another Tile. The new
definition, which extends the base definition, inherits the attributes of the base defi
nition and overrides attributes as needed. When using Tiles, developers commonly
use the approach shown in the Solution. The
mainLayoutDef2
definition defines the
basic layout to be used across the application. In object oriented terms, you can
think of the base definition as an abstract class. The
.start
and
.pageOne
definitions
extend
mainLayoutDef2
. These definitions are like concrete subclasses of the abstract
base class.
The
.start
definition overrides two attributes:
title
and
body
. The overridden
title
specifies title text appropriate for the Start page. The
body
attribute in the base
mainLayoutDef2
does not specify a value; think of it as an abstract property. The
.start
definition overrides the
body
attribute by specifying a concrete value, a JSP page.
The
.pageOne
definition, which extends the
mainLayoutDef2
definition, overrides the
news
attribute and sets the
title
and
body
.
Extending Tile Definitions | 445
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