tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cal" <cal...@holview.com>
Subject RE: RE: Ignore attribute of insertAttribute not working?
Date Thu, 21 Aug 2008 23:10:33 GMT
Ken>> I do not see an issue and have not had time to recreate.  You may want
to simplify and see if you can get it to work.

tiles-defs.xml includes:
  <definition name="common" template="/tiles/template.jsp >
    <put-attribute name="copyright"       value="Copyright notice here" />
    <put-attribute name="pageTitle"       value="Page title here" />
    <put-attribute name="template-footer" value="footer.jsp" />
    <put-attribute name="template-header" value="header.jsp" />
    <put-attribute name="template-body"   value="/tiles/content/home.jsp" />
    <put-attribute name="side-menu"       value=""/>
  </definition>
 

template.jsp includes:
  <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
  <table>
	<tr><td>
    		<tiles:insertAttribute name="header " />    
	</td></tr>
	<tr><td>
	    <tiles:insertAttribute name="side-menu" ignore="true" />
	</td>
	<td>
          <tiles:insertAttribute name="template-body" />
	</td>
     </tr>
	<tr><td>
    		<tiles:insertAttribute name="footer " />    
	</td></tr>
   </table>


the page the user accesses contains only:
  <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
  <tiles:insertDefinition name=" common ">
        <tiles:putAttribute name="template-body"
value="/tiles/content/demos.jsp" cascade="true" />
        <tiles:putAttribute name="side-menu" value="sidebar.jsp" />
  </tiles:insertDefinition>

Same template w/o sidebar - key is orginal definition is empty.
  <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
  <tiles:insertDefinition name="common">
        <tiles:putAttribute name="template-body"
value="/tiles/content/demos.jsp" cascade="true" />
  </tiles:insertDefinition>

Cal
www.calandva.com 

-----Original Message-----
From: users-return-750-calvin=holview.com@tiles.apache.org
[mailto:users-return-750-calvin=holview.com@tiles.apache.org] On Behalf Of
Kenneth Eschrich
Sent: Wednesday, August 20, 2008 9:20 PM
To: users@tiles.apache.org
Subject: Re: RE: Ignore attribute of insertAttribute not working?

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: users-return-748-calvin=holview.com@tiles.apache.org
> [mailto:users-return-748-calvin=holview.com@tiles.apache.org] On Behalf Of
> Kenneth Eschrich
> Sent: Wednesday, August 20, 2008 3:43 PM
> To: users@tiles.apache.org
> 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.

keschrich@graphlogic.com
203.488.1922 x112



Mime
View raw message