You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kevin Bolton <kb...@paychex.com> on 2003/06/16 21:54:15 UTC

Pass parameters to included tiles definition

I have 2 layout definitions, Site.Layout and Context.Layout.  The
Site.Layout is pretty much the ClassicLayout.  The idea is that the body
attribute of the Site.Layout would be overridden to be other tiles as
needed.  I am able to set the body layout to the Context.Layout but I am
unable to change the parameters of the Context.Layout.
 
Here's what I'm trying to do:
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert definition="Site.Layout" flush="true" >
    <tiles:put name="title" value="Administrator Tasks" />
    <tiles:put name="body" value="Context.Layout" type="definition" >
        <tiles:put name="contextMenu" value="/admin/MenuTile.jsp"
type="page" />
        <tiles:put name="contextBody" value="/admin/WelcomeTile.jsp"
type="page" />
    </tiles:put>
</tiles:insert>

I'm getting the Context.Layout inserted with the default values specified in
the definition.  I've been unable to find a way to override the defaults.

Here's my Definitions for completeness:

<definition name="Site.Layout" path="/layout/SiteLayout.jsp">
    <put name="title" value="Enterprise Client and Event Tracking System" />
    <put name="header" value="/HeaderTile.jsp" />
    <put name="menu" value="/MainMenuTile.jsp" />
    <put name="body" value="/WelcomeTile.jsp" />
    <put name="footer" value="/FooterTile.jsp" />
</definition>

<definition name="Context.Layout" path="/layout/ContextLayoutTile.jsp">
    <put name="contextMenu" value="/BlankTile.jsp" />
    <put name="contextBody" value="/BlankTile.jsp" />
</definition>

With those defined and for recap, I'd like to specify the main page to be
Site.Layout and include a Context.Layout as the Site.Layout.body tag.
Naturally, I need to override the default parameters of the Context.Layout.
How can I do this?




-----------------------------------------
The information contained in this message may be privileged, confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or any employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. 

Thank you. Paychex, Inc.

Re: Pass parameters to included tiles definition

Posted by Sandeep Takhar <sa...@yahoo.com>.
I can see two options since what you want to do is not
possible:

The reason it is not possible is because there are
different contexts for each tile.

1. You could try and create another tile which
subclasses the context.layout and put in this tile
instead.

2. Move the attributes to the parent tile and use

tiles:importAttribute scope="request" or something
like that on the jsp.

This imports all tiles context attributes and places
them in request scope.

On the second jsp you could then then use the request
scope vars.

Someone else may have better advice.



sandeep


--- Kevin Bolton <kb...@paychex.com> wrote:
> I have 2 layout definitions, Site.Layout and
> Context.Layout.  The
> Site.Layout is pretty much the ClassicLayout.  The
> idea is that the body
> attribute of the Site.Layout would be overridden to
> be other tiles as
> needed.  I am able to set the body layout to the
> Context.Layout but I am
> unable to change the parameters of the
> Context.Layout.
>  
> Here's what I'm trying to do:
> <%@ taglib uri="/WEB-INF/struts-tiles.tld"
> prefix="tiles" %>
> <tiles:insert definition="Site.Layout" flush="true"
> >
>     <tiles:put name="title" value="Administrator
> Tasks" />
>     <tiles:put name="body" value="Context.Layout"
> type="definition" >
>         <tiles:put name="contextMenu"
> value="/admin/MenuTile.jsp"
> type="page" />
>         <tiles:put name="contextBody"
> value="/admin/WelcomeTile.jsp"
> type="page" />
>     </tiles:put>
> </tiles:insert>
> 
> I'm getting the Context.Layout inserted with the
> default values specified in
> the definition.  I've been unable to find a way to
> override the defaults.
> 
> Here's my Definitions for completeness:
> 
> <definition name="Site.Layout"
> path="/layout/SiteLayout.jsp">
>     <put name="title" value="Enterprise Client and
> Event Tracking System" />
>     <put name="header" value="/HeaderTile.jsp" />
>     <put name="menu" value="/MainMenuTile.jsp" />
>     <put name="body" value="/WelcomeTile.jsp" />
>     <put name="footer" value="/FooterTile.jsp" />
> </definition>
> 
> <definition name="Context.Layout"
> path="/layout/ContextLayoutTile.jsp">
>     <put name="contextMenu" value="/BlankTile.jsp"
> />
>     <put name="contextBody" value="/BlankTile.jsp"
> />
> </definition>
> 
> With those defined and for recap, I'd like to
> specify the main page to be
> Site.Layout and include a Context.Layout as the
> Site.Layout.body tag.
> Naturally, I need to override the default parameters
> of the Context.Layout.
> How can I do this?
> 
> 
> 
> 
> -----------------------------------------
> The information contained in this message may be
> privileged, confidential, and protected from
> disclosure. If the reader of this message is not the
> intended recipient, or any employee or agent
> responsible for delivering this message to the
> intended recipient, you are hereby notified that any
> dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have
> received this communication in error, please notify
> us immediately by replying to the message and
> deleting it from your computer. 
> 
> Thank you. Paychex, Inc.


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org