If you mean that you want to put a sub-tile inside another tile, you could
make something like this:

<snip>
<definition name=".mainLayout" page="/tiles/mainLayout.jsp">
  <put name="header" value="/tiles/header.jsp">
  <put name="footer" value="/tiles/footer.jsp">
  <put name="title" value="My Title"/>  <!-- I modified this piece!!! -->
  <put name="body" value=".nestedLayout"/>
</definition>

<definition name=".nestedLayout" extends=".mainLayout">
  <put name="body" value="/tiles/nestedLayout.jsp"/>
  <put name="nestedBody" value=".nested1"/>
</definition>

<definition name=".nested1" extends=".nestedLayout">
  <put name="title" value="nested page"/>
  <put name="nestedBody" value="/tiles/nested1.jsp"/>
</definition>
</snip>

In other words you can use the "<put>" element not only with JSP pages but
also with other definitions. That is you can make "definitions of
definitions" in a nested fashion.
If you instead wish to make dynamic tiles definitions, maybe you could  be
interested in this thread:
http://mail-archives.apache.org/eyebrowse/ReadMsg?listId=241&msgNo=114600
Ciao
Antonio Petrelli

Bill Schneider wrote:

> I'm trying to do something with Tiles like this:
>
> <definition name=".mainLayout" page="/tiles/mainLayout.jsp">
>   <put name="header" value="/tiles/header.jsp">
>   <put name="footer" value="/tiles/footer.jsp">
>   <put name="title" value="${title}"/>
>   <put name="body" value="${body}"/>
> </definition>
>
> <definition name=".nestedLayout" extends=".mainLayout">
>   <put name="body" value="/tiles/nestedLayout.jsp"/>
>   <put name="nestedBody" value="${nestedBody}"/>
> </definition>
>
> <definition name=".nested1" extends=".nestedLayout">
>   <put name="title" value="nested page"/>
>   <put name="nestedBody" value="/tiles/nested1.jsp"/>
> </definition>
>
> When ".nested1" is displayed, I see the main layout as expected, with
the proper title; and nestedLayout.jsp gets included as the body.  But
inside nestedLayout.jsp, <tiles:get name="nestedBody"/> doesn't work.
>
> I could always do something in mainLayout.jsp like
> <tiles:importAttribute/>
> <tiles:insert name="body">
>   // foreach imported attribute {
>     <tiles:put name="[attr name]" value="[attr value]"/>
>   // }
> </tiles:insert>
>
> This works but doesn't feel right.  Is there a better way to export
attributes or otherwise preserve the current Tiles context through a
tiles:insert or tiles:get?
>
> -- Bill



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

Reply via email to