You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Max Kremer <mk...@datastay.com> on 2003/01/23 00:30:59 UTC

Tiles useAttribute

Hi I'm new to Tiles and I'm trying get some basic stuff working but I'm having a problem passing attributes.
My definition XML file looks like this:

<tiles-definitions>
  <definition name=3D"mainTemplate" path=3D"/mainTemplate.jsp" >
   <put name=3D"Section" value=3D"/partfetch"/>
   <put name=3D"TopMenu" value=3D"/includes/inc_TopMenu.jsp" />
   <put name=3D"Body" value=3D"/inc_PartDetails.jsp" />
   <put name=3D"Footer" value=3D"/includes/inc_Footer.jsp" />
  </definition>
</tiles-definitions>

Now I'm trying to get the value of the "Section" attribute in the inc_Footer.jsp but I get the following error:

[ServletException in:/includes/inc_Footer.jsp] Error - tag useAttribute: attribute 'Section' not found in context. Check tag syntax'=20

What am I doing wrong?

Thanks
Max

Re: Tiles useAttribute

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

  Tiles attributes are like method parameters: they are only accessible 
in the current tiles or method. They aren't accessible in parent or 
nested tiles.
  But, you can pass them explicitly to the nested tile in your template.jsp:

  <tiles:insert attribute="Footer" >
    <tiles:put name="Section" beanName="Section" beanScope="tiles" />
  </tiles:insert>

  Hope this help,
    Cedric

Max Kremer wrote:

>Hi I'm new to Tiles and I'm trying get some basic stuff working but I'm having a problem passing attributes.
>My definition XML file looks like this:
>
><tiles-definitions>
>  <definition name=3D"mainTemplate" path=3D"/mainTemplate.jsp" >
>   <put name=3D"Section" value=3D"/partfetch"/>
>   <put name=3D"TopMenu" value=3D"/includes/inc_TopMenu.jsp" />
>   <put name=3D"Body" value=3D"/inc_PartDetails.jsp" />
>   <put name=3D"Footer" value=3D"/includes/inc_Footer.jsp" />
>  </definition>
></tiles-definitions>
>
>Now I'm trying to get the value of the "Section" attribute in the inc_Footer.jsp but I get the following error:
>
>[ServletException in:/includes/inc_Footer.jsp] Error - tag useAttribute: attribute 'Section' not found in context. Check tag syntax'=20
>
>What am I doing wrong?
>
>Thanks
>Max
>
>  
>


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