You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sri Sankaran <Sr...@sas.com> on 2003/03/25 19:12:22 UTC

[TILES] Passing attributes to tiles

Using Struts 1.1b3

Consider a simple page layout comprised of two tiles, a body and a (wizard-like) navigation bar.  I would like to conditionally disable certain navigational buttons on some pages.  I am trying to use the <tiles:put> and <tiles:useAttribute> to no avail.

Here's a sample tile definition

<definition name="tile.1" path="tile-1.jsp">
  <put name="hideButton" value="yes"/>
  <put name="body" value="tile-1-body.jsp"/>
  <put name="nav" value="tile-1-nav.jsp"/>
</definition>

I find that I can access "hideButton" in tile-1.jsp but not in tile-1-nav.jsp.  

In other words, the following works in tile-1.jsp

<tiles:useAttribute 
  id="hide" 
  name="hideButton" 
  classname="java.lang.String"/>

Hide value is <%=hide%>

But not in any of tile-1-body.jsp or tile-1-nav.jsp.

Is this expected behavior?  Do you have any suggestions on how I can achieve what I am trying?  The one workaround I have is to use a <bean:define> in tile-1.jsp and reference that bean in tile-1-nav.jsp.

Sri