Richard,
Thank you for the response! Unfortunately it is a little unclear to me.
Where would that snippet go? The layoutWithMenu.jsp page? If so, that
still forces me to specify the default value(s) in both layout.jsp and
layoutWithMenu.jsp...which is what I'm really trying to avoid.
I would like to make these layout-components as pass-through components
(pageA.jsp --> layoutWithMenu.jsp --> layout.jsp), but when nothing is
specified/overridden then use the default values from the master
layout.jsp template.
Oh, and just to clean things up, the layout.jsp in my original post is
missing it's html-head section, it should be:
<head><title>${title}</title></head>
-Chris
From:
Richard Hauswald <[email protected]>
To:
Stripes Users List <[email protected]>
Date:
02/26/2010 02:52 AM
Subject:
Re: [Stripes-users] Using both default values and overridden values within
nested layouts?
Hi Chris,
what about
<c:if test="${empty header}">
<c:set var="header">Default Header</c:set>
</c:if>
?
On Tue, Feb 23, 2010 at 8:50 PM, <[email protected]> wrote:
> I'm trying to create a nested layout structure using the Stripes layout
> tags, and am running into a problem.
>
> My goal is to have the following:
> 1. A master layout definition (layout.jsp) that defines the main layout
> (header, body, footer). Here, the header, and footer contents are given
> default values.
> 2. A sub-layout definition (layoutWithMenu.jsp) extends layout.jsp, and
> decorates the body content by adding a menu at the top.
> 3. Be able to create renderer pages that can extend either of the
layouts
> above, be able to override any of the layout-components that they
choose,
> and also to be able to re-use default content that has been specified by
the
> layout definition(s) when overriding is not necessary.
>
> In my example files below, pageA.jsp and pageB.jsp are the renderer
pages.
> They both specify layoutWithMenu.jsp as their layout definition.
> LayoutWithMenu.jsp in turn specifies layout.jsp as its layout
definition.
>
> Within pageA.jsp, I want to be able to override content for
layout-component
> "header". But I want to make sure that the default content for "footer"
is
> still rendered and not overridden.
>
> Within pageB.jsp, I want to be able to override the layout-component
> "footer" and let the default content render for "header".
>
> I can't find a way to conditionally pass the overridden
layout-components
> through layoutWithMenu.jsp only when content has actually been specified
by
> the renderer page. When always passing through all layout-components,
the
> components that are not actually overridden are blanked out (I guess
they
> are overridden by a null value?).
>
>
>
> Here are my files:
>
> (layout.jsp)
> <c:set var="header">
> Default header
> </c:set>
> <c:set var="footer">
> Default Footer
> </c:set>
> <stripes:layout-definition>
> <html>
> </head>
> <body>
> ${header}
> <div>${body}</div>
> ${footer}
> </body>
> </html>
> </stripes:layout-definition>
>
>
> (layoutWithMenu.jsp)
> <stripes:layout-definition>
> <stripes:layout-render name="/WEB-INF/jsp/templates/layout.jsp"
> title="${title}"
> header="${header}"
> footer="${footer}">
>
> <stripes:layout-component name="body">
> <div class="menu">
> <span class="menu-item">
> <stripes:link beanclass="com.MyActionBean"
> event="myEvent1">Menu 1</stripes:link>
> </span>
> <span>|</span>
> <span class="menu-item">
> <stripes:link beanclass="com.MyActionBean"
> event="myEvent2">Menu 2</stripes:link>
> </span>
> </div>
> ${body}
> </stripes:layout-component>
> </stripes:layout-render>
> </stripes:layout-definition>
>
>
> (pageA.jsp)
> <stripes:layout-render name="/WEB-INF/jsp/templates/layoutWithMenu.jsp"
> title="Page A Title">
> <stripes:layout-component name="header">
> Page A Header
> </stripes:layout-component>
>
> <stripes:layout-component name="body">
> Page A Body
> </stripes:layout-component>
> </stripes:layout-render>
>
> (pageB.jsp)
> <stripes:layout-render name="/WEB-INF/jsp/templates/layoutWithMenu.jsp"
> title="Page B Title">
> <stripes:layout-component name="footer">
> Page B footer
> </stripes:layout-component>
>
> <stripes:layout-component name="body">
> Page B body
> </stripes:layout-component>
> </stripes:layout-render>
>
>
> -Chris *************************** IMPORTANT
> NOTE*****************************-- The opinions expressed in this
message
> and/or any attachments are those of the author and not necessarily those
of
> Brown Brothers Harriman & Co., its subsidiaries and affiliates ("BBH").
> There is no guarantee that this message is either private or
confidential,
> and it may have been altered by unauthorized sources without your or our
> knowledge. Nothing in the message is capable or intended to create any
> legally binding obligations on either party and it is not intended to
> provide legal advice. BBH accepts no responsibility for loss or damage
from
> its use, including damage from virus.
>
********************************************************************************
>
------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Richard Hauswald
Blog: http://tnfstacc.blogspot.com/
LinkedIn: http://www.linkedin.com/in/richardhauswald
Xing: http://www.xing.com/profile/Richard_Hauswald
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
*************************** IMPORTANT NOTE *****************************
--|
The opinions expressed in this message and/or any attachments are those of the
author and not necessarily those of Brown Brothers Harriman & Co., its
subsidiaries and affiliates BBH. There is no guarantee that this message is
either private or confidential, and it may have been altered by unauthorized
sources without your or our knowledge. Nothing in the message is capable or
intended to create any legally binding obligations on either party and it is
not intended to provide legal advice. BBH accepts no responsibility for loss or
damage from its use, including damage from virus.
*******************************************************************------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users