You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hue Holleran <hu...@softwareskills.net> on 2002/10/30 18:01:35 UTC

[Tiles] Accessing layout attribute from a page (tile)

Is it possible to access a tiles layout attribute from a tile?

e.g. if a layout is defined with an attribute, e.g. "x":

  <definition name="rootLayout" path="rootLayout.jsp">
    <put name="x" value="Hello" direct="true />
    <put name="body" value="page.jsp" />
  </definition>

How would I access the attribute "x" in "page.jsp"?

Attempting to do <tiles:insert attribute="x"/> in page gives a "Error - Tag
Insert : No value found for attribute 'x'".

I've also tried using the <importAttribute/> tag but this does not seem to
allow access to the attribute.

Sorry if this is a dumb question with a simple answer but we really have
tried reading every bit of documentation available on Tiles but are still
failing to grasp this.

Hue.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Tiles] Accessing layout attribute from a page (tile)

Posted by Cedric Dumoulin <ce...@apache.org>.
  You can't access attribute "x" from your "page.jsp".
  Tiles attribute are like method's parameters: they are only visible in 
the inserted tiles, not in the surrounding tiles and not in sub-inserted 
tiles.
  If you want to access "x" from page.jsp, you have to pass it 
explicitly. This can be done in the rootLayout:

  <tiles:insert attribute="body" >
    <tiles:put beanName="x" beanScope="tiles" />
</tiles:insert>

  Cedric

Hue Holleran wrote:

>Is it possible to access a tiles layout attribute from a tile?
>
>e.g. if a layout is defined with an attribute, e.g. "x":
>
>  <definition name="rootLayout" path="rootLayout.jsp">
>    <put name="x" value="Hello" direct="true />
>    <put name="body" value="page.jsp" />
>  </definition>
>
>How would I access the attribute "x" in "page.jsp"?
>
>Attempting to do <tiles:insert attribute="x"/> in page gives a "Error - Tag
>Insert : No value found for attribute 'x'".
>
>I've also tried using the <importAttribute/> tag but this does not seem to
>allow access to the attribute.
>
>Sorry if this is a dumb question with a simple answer but we really have
>tried reading every bit of documentation available on Tiles but are still
>failing to grasp this.
>
>Hue.
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>