I think the problem that Oliver was having (expressed through your example) was that the webpage defined by level3.pagedef.content (/web/pages/level3/Level3Content.jsp) could not access attributes defined in the same context (for example, level3.pagedef.index (/web/pages/level3/Level3Index.jsp).

-----Original Message-----
From: struts-user-digest-help@jakarta.apache.org
[mailto:struts-user-digest-help@jakarta.apache.org]
Sent: Monday, December 08, 2003 12:11 PM
To: struts-user@jakarta.apache.org
Cc: calvin@holview.com
Subject: RE: Tiles, Definition inheritence

The issue that keeps coming up is the ability for jsps other than the
"page=" (template) jsp to have access to the attributes. John provided a
good technique using a second definition.  As to the definitions and the
template's ability to access attributes - you can add attributes to extended
definitions and then extend them.

I have an example app using that technique on my site:
http://www.calandva.com/holmansite/do/blog/blogging?date=20030711#094831

In this app I access the Tiles Context in an action and in a tag to modify
the attributes on the fly.  In the advanced pdf Cedric provides an example
of creating the number of columns in the body of a template on the fly.

  <definition name="home.pagedef" page="/template.jsp"
controllerUrl="/do/renderCrumb" >
	  <put name="title"  			value="home.title" />
	  <put name="header" 		value="/web/includes/header.jsp" />
	  <put name="index"   		value="/web/pages/home/HomeIndex.jsp" />
	  <put name="content"   	value="/web/pages/home/HomeContent.jsp" />
	  <put name="footer" 		value="/web/includes/footer.jsp" />
    	  <put name="styleSheet" 	value="web/styles/Grey_StyleSheet.css" />
    	  <put name="keywords" 	value="home.keywords"/>
    	  <put name="crumbs" 		value="/web/includes/crumb.jsp"/>
	  <put name="crumbtitle1" 	value="Home"/>
	  <put name="crumblink1" 	value="do/AutoForward?forward=home.pagedef"/>
	  <put name="pagename"	value="home"/>
  </definition>

   <definition name="level2.pagedef" extends="home.pagedef">
	  <put name="title"              value="level2.title" />
	  <put name="index"            value="/web/pages/level2/Level2Index.jsp" />
	  <put name="content"         value="/web/pages/level2/Level2Content.jsp"
/>
	  <put name="keywords"      value="level2.keywords"/>
	  <put name="crumbtitle2"    value="Level 2"/>
	  <put name="crumblink2"    value="do/AutoForward?forward=level2.pagedef"/>
	  <put name="pagename"	  value="level2"/>
  </definition>

   <definition name="level3.pagedef" extends="level2.pagedef">
	  <put name="title"              value="level3.title" />
	  <put name="index"            value="/web/pages/level3/Level3Index.jsp" />
	  <put name="content"        value="/web/pages/level3/Level3Content.jsp" />
	  <put name="crumbtitle3"   value="Level 3"/>
	  <put name="crumblink3"   value="do/AutoForward?forward=level3.pagedef"/>
	  <put name="pagename"	 value="level3"/>
  </definition>

When the level3.pagedef is used the template.jsp has access to all three
levels of crumbtitle values.  Some attributes are overridden and others are
added as the definitions are extended. Any attribute you add in the extended
path is available to the extended template.

Let me know if I am off base.

Cal
www.calandva.com

-----Original Message-----
From: struts-user-return-100962-calvin=holview.com@jakarta.apache.org
[mailto:struts-user-return-100962-calvin=holview.com@jakarta.apache.org]On
Behalf Of Hibbs, David
Sent: Monday, December 08, 2003 10:12 AM
To: 'Oliver Wulff'; struts-user@jakarta.apache.org
Subject: RE: Tiles, Definition inheritence

        This is (IMHO) a classic issue with tiles.  The Tiles meaning of
'inheritance' isn't quite the same as in Java or other OO concepts.  Tiles
inherit values from their parents, and can override those values.  However,
adding new values is not supported.
        The only way [that I've found, anway] that you can support the
addition of new properties is to use the tiles importAttribute tag (see
http://jakarta.apache.org/struts/userGuide/struts-tiles.html#importAttribute
) in the main layout JSP, i.e. /layout/classicLayout.jsp, to pass the values
into a scope where they can be found by other tags such as <bean:write> and
use the values that way.

David Hibbs, ACS
Staff Programmer / Analyst
American National Insurance Company

> -----Original Message-----
> From: Oliver Wulff [mailto:oliver.wulff@zurich.ch]
> Sent: Monday, December 08, 2003 5:16 AM
> To: struts-user@jakarta.apache.org
> Subject: Tiles, Definition inheritence
>
> Hi
>
> I'm quite new to Tiles and I've got the following problem:
>
> I've defined the following default definition:
> <definition name=".mainLayout" path="/layout/classicLayout.jsp">
>       <put name="title"  value="Berechtigung WEB with Tiles" />
>       <put name="header" value="/top_menu.jsp" />
>       <put name="menu"   value="/toc.jsp" />
>       <put name="footer" value="/footer.jsp" />
>       <put name="body"   value="/welcome.jsp" />
> </definition>
>
> The classicLayout.jsp hasn't been changed (Struts examples).
>
> Additionally, I've defined the following Definition:
> <definition name=".showOrgEinheit" extends=".mainLayout">
>       <put name="input" value="/getOrgEinheit.jsp" />
>       <put name="result" value="/showOrgEinheit.jsp" />
>       <put name="body" value="/layout/bodyTwoColumns.jsp" />
> </definition>
>
> The bodyTwoColumns looks like this:
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
>
> <table border="0" width="100%" cellspacing="5">
> <tr>
>   <td width="50%" align="left">
>     <tiles:insert attribute='input'/>
>   </td>
>   <td width="50%" align="left">
>     <tiles:insert attribute='result' />
>   </td>
> </tr>
> </table>
>
> My struts action forwards to the definition .showOrgEinheit
> but I get the
> following error:
> [ServletException in:/layout/bodyTwoColumns.jsp] Error - Tag
> Insert : No
> value found for attribute 'input'.'
>
> Can anybody help me, please? Thank you a lot.
>
> Cheers
> Oliver
>
>
>
>
>
>
> ******************* BITTE BEACHTEN *******************
> Diese Nachricht (wie auch allfällige Anhänge dazu) beinhaltet
> möglicherweise vertrauliche oder gesetzlich geschützte Daten oder
> Informationen. Zum Empfang derselben ist (sind) ausschliesslich die
> genannte(n) Person(en) bestimmt. Falls Sie diese Nachricht
> irrtümlicherweise erreicht hat, sind Sie höflich gebeten, diese unter
> Ausschluss jeder Reproduktion zu zerstören und die absendende Person
> umgehend zu benachrichtigen. Vielen Dank für Ihre Hilfe.
>
>

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