Hermod, Gary,

Thanks a lot for your help. So it was actually easier than I thought. I'm
really falling in love with Clay. Using jsp, jsf and html together in an
extendable matter like this really makes my life easier. I can use a lot of
building blocks from my previous versions. It also makes phasing JSP out
possible in stead of having to do a complete changeover at once. And
extending views... gotta love it!

Cheers,
Joost
-----Original Message-----
From: Gary VanMatre [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 11, 2007 5:28 AM
To: [email protected]
Subject: Re: Clay nested templates

>Hi,
>
>I'm experimenting with Clay and I like it. A few things are not quite clear
>to me though. I can make my page /user_calendar.jsf work with the following
>clay config:
>
><component jsfid="baseHomeLayout" extends="clay" id="baseHomeLayout">
><attributes>
><set name="clayJsfid" value="/templates/main_template.html" />
></attributes>
><symbols>
><set name="title" value="#{webLabels['msg.public.headTitle']}" />
><set name="content" value="/components/empty.html" />
></symbols>
></component>
> 
><component jsfid="/user_calendar.jsf" extends=" baseHomeLayout ">
><symbols>
><set name="content" value="/components/empty.html" />
></symbols>
></component>
>
>But I wish to insert another template inside a template, and thought the
>following might work:
> 
><component jsfid="/user_calendar.jsf" extends="baseHomeLayout">
><set name="content" value="/templates/column_template.html">
><symbols>
><set name="left_column" value="/components/empty.html" />
><set name="right_column" value="/components/empty.html" />
></symbols>
></set>
></symbols>
></component>
>

The XML above shouldn't validate to the clay DTD [1].  Try adding all
symbols under the "symbols" node.

<component jsfid="/user_calendar.jsf" extends="baseHomeLayout">
  <symbols>
      <set name="content" value="/templates/column_template.html">
      <set name="left_column" value="/components/empty.html" />
     <set name="right_column" value="/components/empty.html" />
 </symbols>
</component>


The symbols are passed on to nested layers of included templates.
There is an example of this in the shale-usecases.  A "table" template [2] 
incudes another markup template [3] that passes symbols to XML
component definitions.   The component definitions are passed
symbols through 2 layers of markup templates.

 <component jsfid="widgetsLabel" extends="baseLabel">
  <attributes>
   <set name="value" value="@label" />
   <set name="for" value="@property" />
  </attributes>
 </component>
 <component jsfid="widgetsText" extends="inputText" id="@property">
  <attributes>
   <set name="value" value="[EMAIL PROTECTED]@property}" />
   <set name="size" value="@size" />
   <set name="maxlength" value="@maxlength" />
   <set name="required" value="@required" />
   <set name="immediate" value="@immediate" />
  </attributes>
 </component>
 <component jsfid="widgetsMessage" extends="baseMessage">
  <attributes>
   <set name="for" value="@property" />
  </attributes>
 </component>
 


[1] http://shale.apache.org/dtds/clay-config_1_0.dtd
[2]http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-clay-
usecases/src/main/webapp/symbols/businessPerson.html?view=markup
[3]
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-clay-use
cases/src/main/resources/org/apache/shale/usecases/symbols/inputTextWidget.h
tml?view=markup


>but it doesn't. I get the parse error:
>java.lang.NoSuchMethodException: No such accessible method: addSymbol() on
>object: org.apache.shale.clay.config.beans.SymbolBean.
>
>I guess I will need to create an Element for the inserted template, but
>tried different approaches but can't seem to get it to work. I could
>obviously create a second complete template hardcoding
>/templates/column_template.html in /templates/main_template.html, but that
>defeats the Clay purpose.
>
>Thank you,
>joost


Gary

Reply via email to