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 601 | Next

Larry Brown, Marty Hall, and Yaakov Chaikin

"Core Servlets and JavaServer Pages, Volume 2"


2. Make a template file that represents the layout. In your template
file, use tiles:insert wherever a layout piece should go. Also, use
tiles:getAsString wherever changeable text goes. Both of these
tiles: tags act as stubs that are later filled in by other pieces. To prevent
direct access of the template file, place the file in WEB-INF or a
subdirectory.
3. Create JSP pages that define the layout pieces. Create JSP pages
that contain HTML fragments for the stubbed-out layout. To prevent
direct access to these fragments, also put them in WEB-INF or a subdirectory.
4. Create JSP pages that populate the layout. Use tiles:insert
to refer to the layout from Step 1. Use tiles:put to specify the layout
pieces that apply to each specific page. Unless forwarding the
request to the output pages through RequestDispatcher, place
these JSP files in a directory normally accessible by the user (do not
place them in WEB-INF).
Details follow.
Step 1: Sketch the Desired Layout
Many Web sites have groups of pages that have a common general layout, for
instance, a common header, title, menu, body, and footer. Often only one or two parts
(e.g., the body) changes from page to page.

chainConfig

org/apache/struts/tiles/chain-config.xml


2

Listing 11.9 Struts servlet entry in web.


Pages:
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613