Java Reference
In-Depth Information
Chapter 7
Reusable Layouts
Web applications are typically composed of several pages. As soon as
you have more than one page in your application, you'll notice that
some parts are the same for every page: the HTML header code, the
title, the footer, and so on. You certainly don't want to copy and paste
those parts in every page and then have the nightmare of maintaining
all that duplicated code. Reusable layouts to the rescue: you put the
common parts in one place and reuse them in as many pages as you
like. Then, when you want to make a change to the header, for example,
you have only one file to edit. All pages that use this file will automat-
ically inherit the change. This makes it easier to maintain consistency
in your application—no more “Oops, how come the new header appears
only in some pages but not others?”
Having one place for static code is only half the story. You also want to
be able to assemble your pages with dynamic content that comes from
each page. You need a way of saying “The title goes here, the body of
the page goes there. . . whatever they may be.” Each page specifies its
own content for the title, body, and so on, and the layout assembles all
the parts together to produce the final result.
Stripes gives you a simple and powerful reusable layout system. You
don't need to install any additional libraries to use it, and you won't
have to create and maintain any configuration files either!
 
 
 
Search WWH ::




Custom Search