Java Reference
In-Depth Information
<s:layout-component name="adsRight">
Default Ads right
</s:layout-component>
</td></tr>
</table>
</s:layout-definition>
By placing the <c:set> tags before the <s:layout-definition> tag, we
are setting values that act as defaults. Indeed, these values are used
unless they are overridden by the renderer's own values.
Now, this renderer:
Download reusable_layouts/web/default_content_in_decorators/renderer.jsp
<s:layout-render name="/default_content_in_decorators/layout_decorator.jsp">
<s:layout-component name="body">
Hello, reusable layout
</s:layout-component>
<s:layout-component name="adsRight">
My Ads Right
</s:layout-component>
</s:layout-render>
produces the following:
Header
Default Ads Left
Default Menu Hello, reusable layout
My Ads Right
Footer
As we can see, setting default values with <c:set> gives us the same
behavior as with <s:layout-component>: defaults are used unless over-
ridden by the renderer. It's also with <c:set> that we can have defaults
for values provided by renderers in attributes, as in <s:layout-render
name="/layout.jsp" title="My Title"> . We would use <c:set var="title">Default
title</c:set> to have a default title in layout.jsp .
Adding Pages to the Webmail Application
Let's use layout decorators to add pages to the webmail application.
Skeletons of these pages are shown in Figure 7.2 , on page 153 . We'll
start adding content to the pages in the next chapter—for now, let's
focus on the layouts.
 
 
Search WWH ::




Custom Search