Hi,


Once again ;-) :
The attributes of a tile are only accessible from this tile, not from its sub- tiles or its parent. Attributes of a tile are like parameters of a method: they are only visible in this method.


It is why you can't access the title attribute owned by the layout from the header tile.
To access it, you need to pass it explicitly to the tile:
<tiles:insert attribute="header" >
<tiles:put name="title" beanName="title" beanScope="tiles" />
</tiles:insert>


Cedric

Steve Stair wrote:

Inside /layouts/layout.jsp page, I have the following:

  <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
  <title><tiles:getAsString name="title"/></title>

Which works fine, the page title as defined in the tiles defintion file
is displayed in the browser's title bar


However, when I attempt to use that same title in /tiles/header.jsp


  <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
   <h1><tiles:getAsString name="title"/></h1>

I get the following error message:

[ServletException in:/tiles/header.jsp] Error - tag.getAsString :
attribute 'title' not found in context. Check tag syntax'



I haven't been able to find an example that does this. So far I've only found an example that statically includes the header file, which somewhat defeats the purpose of using Tiles.

My definition looks like this

 <definition name=".app.Base" path="/layouts/layout.jsp">
   <put name="title" value="${title}" />
   <put name="header" value="/tiles/header.jsp" />
   <put name="nav" value="/tiles/nav.jsp" />
   <put name="messages" value="/tiles/messages.jsp" />
   <put name="content" value="${content}" />
   <put name="footer" value="/tiles/footer.jsp" />
 </definition>


-- Steve Stair


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to