struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Dumoulin <ced...@apache.org>
Subject Re: Tiles: passing attributes to definitions
Date Sat, 08 Feb 2003 21:36:56 GMT

  Hi,

  The solution is to declare a menu definition for each of your 
different menu:
    <definition name="menu.mypage" extends="menu">
        <put name="activeMenu" value="mypage"/>
    </definition>

and:
    <definition name="mypage" extends="layout">
        <put name="menu" value="menu.mypage"/>
        <put name="body" value="/myBody.jsp"/>
    </definition>

  Another solution is to add an attribute to mypage, and let the layout 
pass this attribute to the menu:
    <definition name="mypage" extends="layout">
        <put name="menu" value="menu"/>
        <put name="page.name" value="mypage" />
        <put name="body" value="/myBody.jsp"/>
    </definition>

and in layout.jsp:
<tiles:insert attribute="menu" >
  <tiles:put name="activeMenu" beanName="page.name" beanScope="tile"/>
</tiles:insert>

  Hope this help,

  Cedric



Igor Lyubimov wrote:

> Hallo, All!
>
> I'm trying to use struts with tiles framework. The idea of tiles 
> definitions seems to be very good. But I can't find how is it possible 
> to pass the attributes to the definitions, which I use as attribute.
>
> Here is an example with the explanation of my problem:
>
> Suppose, I need to build the portal with the classical layout (header, 
> left side menu, content and footer).
>
> I've made the following definitions for this layout
>
> ------------------------------------------------------------
>     <definition name="layout" path="/layout.jsp">
>         <put name="header" value="/header.jsp"/>
>         <put name="menu" value="menu"/>
>         <put name="body" value=""/>
>         <put name="footer" value="/footer.jsp"/>
>     </definition>
>     <definition name="menu" path="/menu.jsp">
>         <put name="activeMenu" value=""/>
>     </definition>
> ------------------------------------------------------------
>
> The activeMenu attribute for menu definition says to menu which item
> should be marked as active for current page.
>
> Suppose, I have the following definition for my page
> ------------------------------------------------------------
>     <definition name="mypage" extends="layout">
>         <put name="menu">
>             <insert beanName="menu">
>                 <put name="activeMenu" value="mypage"/>
>             </insert>
>         </put>
>         <put name="body" value="/myBody.jsp"/>
>     </definition>
> ------------------------------------------------------------
>
> This definition is broken (attribute "menu"), but I need to pass the
> attribute for menu definition as a parameter. How can I do this?
>
> I whant to pass the active menu name as an attribute for menu in each
> page (they all look like mypage).
>
> Or is it impossible in tiles definitions to pass attributes this way?
> Probably exists a workaroud for this cases?
>
> Thanks,
>
>


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


Mime
View raw message