Thanks for the reply. My setup is probably more complicated than it
needs to be, but here are the pertinent sections.. Cascading is a
feature new to 2.1.0, is it possible that it doesn't play nicely with
ignore?
tiles-defs.xml includes:
<definition name="common">
<put-attribute name="copyright" value="Copyright notice here"
cascade="true" />
<put-attribute name="pageTitle" value="Page title here"
cascade="true"/>
</definition>
<definition name="template" template="/tiles/template.jsp"
extends="common">
<put-attribute type="definition" name="template-footer"
value="footer" />
<put-attribute type="definition" name="template-header"
value="header" />
</definition>
template.jsp includes:
<div id="content_body">
<tiles:insertAttribute name="side-menu" ignore="true" />
<tiles:insertAttribute name="template-body" />
</div>
the page the user accesses contains only:
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insertDefinition name="template">
<tiles:putAttribute name="template-body"
value="/tiles/content/demos.jsp" cascade="true" />
</tiles:insertDefinition>
Ken
Cal wrote:
I just gave the insertAttribute with ignore a try and it did not get an
error - I am using 2.0.6. What does your template look like? Is the
insertAttribute included in another tag?
Cal
www.calandva.com
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Kenneth Eschrich
Sent: Wednesday, August 20, 2008 3:43 PM
To: [email protected]
Subject: Ignore attribute of insertAttribute not working?
Using Tiles 2.1.0 (beta?)
I have a tile template.jsp, which then inserts other tiles, header.jsp,
footer.jsp, content definition, and side-menu definition. The two
definitions vary with the page being loaded. Everything works great for
the most part, except for one page which does not have a side-menu. When
going to this page I got an exception stating that "Attribute
'side-menu' not found".
Of course I could just create a copy of template.jsp which does not
include the side-menu, but looking at the documentation I found there is
an "ignore" attribute of insertAttribute which "if this attribute is set
to true, and the attribute specified by the name does not exist, simply
return without writing anything. The default value is false, which will
cause a runtime exception to be thrown." So I changed the relevant line
in template.jsp to <tiles:insertAttribute name="side-menu" ignore="true" />
Now, when I go to this particular page I do not get the exception from
before, but rather this: "org.apache.tiles.impl.CannotRenderException:
Cannot render a null attribute"
Any thoughts what could be going on here?
Thanks,
Ken
--
Kenneth Eschrich
Application Software Engineer & IT
GraphLogic, Inc.
[EMAIL PROTECTED]
203.488.1922 x112