Contrary to popular belief, tiles attributes are not propagated to
jsp's defined as attributes. It means that _header.jsp doesn't have
any information about a tile attribute 'title', thus ignoring the
<tiles:getAsString/> tag (when you remove the ignore="true", struts is
actually throwing an exception, that's why you get a blank page).

In order to do what you want you have to define your tiles as:

<!-- main layout -->
<definition name="Main.layout" path="/_common/layouts/mainLayout.jsp">
  <put name="header" value="layout.header" />
  <put name="footer" value="/_common/layouts/tiles/_footer.jsp" />
</definition>

<definition name="layout.header" path="/_common/layouts/_header.jsp">
  <put name="title" value="Test" />
</definition>

<!-- test Page -->
<definition name="Test.page" extends="Main.layout">
</definition>

Hope this helps.

On 9/28/05, Graham Reeds <[EMAIL PROTECTED]> wrote:
> I have my pages defined in tiles-defs.xml thus:
>
> <!-- main layout -->
> <definition name="Main.layout" path="/_common/layouts/mainLayout.jsp">
>    <put name="header" value="/_common/layouts/tiles/_header.jsp" />
>    <put name="footer" value="/_common/layouts/tiles/_footer.jsp" />
> </definition>
>
> <!-- test Page -->
> <definition name="Test.page" extends="Main.layout">
>    <put name="title" value="Test" />
> </definition>
>
> mainLayout.jsp is:
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> <tiles:insert attribute="header" />
> <tiles:insert attribute="footer" />
>
> Test.jsp is:
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> <tiles:insert definition="Test.page" />
>
> So following the from the click of the link to Test.jsp.  The tiles for
> Test.page are looked up in the tiles-defs.xml.  This shows that
> Test.page extends Main.layout, differing in the fact that Test.page has
> a title of the value of Test.  title referenced in _header.jsp via
> <tiles:getAsString name="title" ignore="true" />.
>
> However when the page is rendered it displays the _header.jsp and
> _footer.jsp tiles but does not give the new title, leaving it blank. If
> I remove the ignore="true" attribute from the getAsString tag then it
> renders nothing.  Why doesn't the title get picked up?
>
> Thanks, Graham Reeds
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Guillermo Castro             [EMAIL PROTECTED]
Monterrey NL, Mexico     http://www.javageek.org/

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

Reply via email to