You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Graham Leggett <mi...@sharp.fm> on 2003/11/12 18:57:35 UTC

Can tiles contain tiles?

Hi all,

I have a tile, and within that tile, I have attempted to insert another 
tile. The nested <tiles:insert> tag runs, but finds no definition in the 
  tile-defs.xml file when the definition is there.

If I copy the nested tiles:insert tag out of the tile and into the base 
jsp page where all the other tiles live, the tile works fine.

Is nesting tiles even possible using Struts v1.1? If not, is there a 
reason for this, or is this a bug?

Regards,
Graham
--


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


RE: Can tiles contain tiles?

Posted by Norm Deane <no...@vanderbilt.edu>.
Yes, you can nest tiles.  One example would be...

Given this base definition...

    <!-- Main page layout.  Defines the welcome view. -->
    <definition name="tile:template.main.layout"
path="/jsp/common/layout.jsp">
        <put name="page.title"      value="application.title" />
        <put name="page.header"     value="/jsp/common/header.jsp" />
        <put name="page.body"       value="/jsp/content/welcome.jsp"/>
        <put name="page.footer"     value="/jsp/common/footer.jsp" />
        <put name="page.snoop"      value="/jsp/common/snoop.jsp"/>
    </definition>


And this extension which uses employeeList.jsp as the body...

    <!-- Display list of employees using the person table component. -->
    <definition name="tile:employee.list"
extends="tile:template.main.layout">
        <put name="page.body"
value="/jsp/content/employeeList.jsp"/>
    </definition>


And this as the implementation of employeeList.jsp...

    <%@ taglib uri='/tags/struts-tiles' prefix='tiles' %>
    <%@ taglib uri='/tags/struts-bean'  prefix='bean' %>
    <%@ taglib uri='/tags/struts-html'  prefix='html' %>

    <div align="right">
        <html:link action="Welcome">Home</html:link>
    </div>
    <p/>

    <bean:message key="employee.list.text"/> <p/>

    <tiles:insert definition="tile:component.person.table">
        <tiles:put name="people" beanName="requestDataKey"/>
    </tiles:insert>


Which inserts the "tile:component.person.table" tile which is defined as...

    <!-- Component for building a person table. -->
    <definition name="tile:component.person.table"
path="/jsp/common/personTable.jsp">
        <!-- This is merely a placeholder attribute.  The page using the
person table component
             is responsible for putting a list of
edu.vanderbilt.mis.bean.Person objects in the
             tiles scope when inserting this component. -->
        <put name="people"/>
    </definition>

For the complete source see...
http://people.vanderbilt.edu/~norment.deane/struts-tiles/struts-tiles.war

-- 
Norm Deane
MIS Consultant
Vanderbilt University
(615) 322-7855
norm.deane@vanderbilt.edu 

> -----Original Message-----
> From: Graham Leggett [mailto:minfrin@sharp.fm] 
> Sent: Wednesday, November 12, 2003 11:58 AM
> To: struts-dev@jakarta.apache.org
> Subject: Can tiles contain tiles?
> 
> 
> Hi all,
> 
> I have a tile, and within that tile, I have attempted to 
> insert another 
> tile. The nested <tiles:insert> tag runs, but finds no 
> definition in the 
>   tile-defs.xml file when the definition is there.
> 
> If I copy the nested tiles:insert tag out of the tile and 
> into the base 
> jsp page where all the other tiles live, the tile works fine.
> 
> Is nesting tiles even possible using Struts v1.1? If not, is there a 
> reason for this, or is this a bug?
> 
> Regards,
> Graham
> --
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org