SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 621 | Next

Larry Brown, Marty Hall, and Yaakov Chaikin

"Core Servlets and JavaServer Pages, Volume 2"

With Tiles
Definitions, you don??™t have to repeat common elements.
??? Centralized changes. The locations of the various layout pieces (JSP
fragments) are scattered around multiple JSP pages, so if locations
change, multiple files need to be edited. With Tiles Definitions, you
have fewer layout pieces scattered throughout your site and less
editing.
??? Usage of config files. Struts philosophy is to put as much as possible
in config files and as little as possible in JSP and Java code. Tiles
Definitions permits you to define most of your layout in a single file.
The Five Basic Steps in Using Tiles Definitions
Next, we outline the five basic steps in using Tiles Definitions. The first three steps
are the same as for basic Tiles. The last two steps are new.
1. Sketch out the desired layout. As with the previous Tiles approach,
we recommend that you sketch the basic page layout for your site on a
piece of paper.
2. Make a template file that represents the layout. Use
tiles:insert wherever a layout piece (JSP fragment) should go.
Also, use tiles:getAsString wherever changeable text goes. Both
these tiles: tags act as stubs that are later filled in by other pieces.
Chapter 11 ?–  The Struts Framework: Doing More 584
3. Create JSP pages that define the layout pieces. Create JSP pages
that contain HTML fragments for the stubbed-out layout.
4. Define layouts in WEB-INF/tiles-defs.xml. In the definition file,
define a top-level layout and any derived layouts.


Pages:
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633