Java Reference
In-Depth Information
Again, the solution is to use ${menu} :
Download reusable_layouts/web/ads_and_menu_component/layout_decorator.jsp
<s:layout-definition>
<table>
<tr>
<td><s:layout-component name="adsLeft"/></td>
<td>
<s:layout-render name="/ads_and_menu_component/layout.jsp">
<s:layout-component name="body">
<table>
<tr>
<td> ${menu} </td>
<td> ${body} </td>
</tr>
</table>
</s:layout-component>
</s:layout-render>
</td>
<td><s:layout-component name="adsRight"/></td>
</tr>
</table>
</s:layout-definition>
Now, the renderer can provide its own menu with the "menu" compo-
nent. Looking again at the previous listing, you see that you can also
turn the ads on the left and right into components. In this case, the par-
ent layout tag is <s:layout-definition>, so you can use the <s:layout-
component> tag for these components— "adsLeft" and "adsRight" . 3 The
content for these components is now also provided by each renderer.
For example, the following:
Download reusable_layouts/web/ads_and_menu_component/renderer.jsp
<s:layout-render name="/ads_and_menu_component/layout_decorator.jsp">
<s:layout-component name="body">
Hello, reusable layout
</s:layout-component>
<s:layout-component name="menu">
My Menu
</s:layout-component>
<s:layout-component name="adsLeft">
My Ads Left
</s:layout-component>
<s:layout-component name="adsRight">
My Ads Right
</s:layout-component>
</s:layout-render>
3. Note that you could still use ${adsLeft} and ${adsRight} here—in this case, it would be
up to you to choose the notation that you prefer.
 
Search WWH ::




Custom Search