You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ian Beaumont <IB...@categoric.com> on 2002/02/22 13:36:27 UTC
Nesting Tiles within each other problem
I have a page, which uses <tiles:insert> to insert another page that also
has a <tiles:insert>. Is this possible? I just keep getting a servlet
exception. Below is a simplified example of what I'm doing.
base.jsp
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<html:html locale="true">
<body>
<tiles:insert attribute="body"/>
</body>
</html:html>
middle.jsp
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<tiles:insert attribute="anotherBody"/>
top.jsp
<p>Hello World</p>
>From tiles definition
<definition name="/baseLayout" path="/base.jsp">
<put name="body" value=""/>
</definition>
<definition name="/middleLayout" extends="/baseLayout">
<put name="body" value="/middle.jsp"/>
<put name="anotherBody" value=""/>
</definition>
<definition name="/top" extends="/middleLayout">
<put name="anotherBody" value="/top.jsp"/>
</definition>
The error I get on trying to display the page 'top' is:
ServletException in:/middle.jsp] Error - Tag Insert : No value found for
attribute 'anotherBody'.'
Thanks
Ian Beaumont
Re: Nesting Tiles within each other problem
Posted by Cedric Dumoulin <ce...@lifl.fr>.
Sure it is possible.
In your example, what url do you use to access the page ?
Remember that a definition name is a logical name. It can not be used as an
url. You can use it in <insert name="defName" />, or as the path of a Struts
forward.
Ian Beaumont wrote:
> I have a page, which uses <tiles:insert> to insert another page that also
> has a <tiles:insert>. Is this possible? I just keep getting a servlet
> exception. Below is a simplified example of what I'm doing.
>
> base.jsp
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> <html:html locale="true">
> <body>
> <tiles:insert attribute="body"/>
> </body>
> </html:html>
>
> middle.jsp
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> <tiles:insert attribute="anotherBody"/>
>
> top.jsp
> <p>Hello World</p>
>
> >From tiles definition
> <definition name="/baseLayout" path="/base.jsp">
> <put name="body" value=""/>
> </definition>
>
> <definition name="/middleLayout" extends="/baseLayout">
> <put name="body" value="/middle.jsp"/>
> <put name="anotherBody" value=""/>
> </definition>
>
> <definition name="/top" extends="/middleLayout">
> <put name="anotherBody" value="/top.jsp"/>
> </definition>
>
> The error I get on trying to display the page 'top' is:
> ServletException in:/middle.jsp] Error - Tag Insert : No value found for
> attribute 'anotherBody'.'
> Thanks
> Ian Beaumont
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>