Java Reference
In-Depth Information
Layouts Are Flexible
The name of the layout in the <s:layout-render> tag does not
have to be a static value. For example, you might like to render
different layouts according to the user's preference or depend-
ing on whether the user has guest or administrator access rights.
You can use a runtime value as the name of the layout, as fol-
lows:
<s:layout-render name="${someValue}"> ... </s:layout-render>
You can now write code that uses whatever criteria that you
need to dynamically set the value of the someValue variable to
the path and name of the layout file.
Another nice layout feature is that you can specify a compo-
nent only once in a renderer but use that component multiple
times in the layout. For example, you might want to have the
list of links that a renderer provides both at the top and at the
bottom of a layout. There's no problem with placing the same
component in more than one location in the layout.
When the user arrives at the application, the Login page appears. If the
user doesn't already have an account, the Registration page is available
to create one.
Once inside the application, a menu at the top divides the pages into
three sections: Messages, Contact List (which we've already imple-
mented), and Compose. Notice that the Login and Registration pages
just have a welcome message in place of the menu.
The pages of the Message List section, which include the list of mes-
sages and the detailed view of a message, have an additional feature:
the list of folders is shown on the left part of the page.
To support these variants of what's included in a page, we will use
a structure of three layouts: layout_main.jsp , layout_menu.jsp , and lay-
out_folders.jsp . As you can see in Figure 7.3 , on page 154 , each lay-
out builds on the previous layout. The base layout is layout_main.jsp . It
shows the page title on the top-left corner of the page and has a menu
component to show a menu next to the title. By default, the text Wel-
come to Stripes Webmail is displayed in place of the menu. The main
part of the page is the body component.
 
 
Search WWH ::




Custom Search