You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by JS Portal Support <su...@jsportal.com> on 2007/04/10 13:22:58 UTC

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>

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



SV: Clay nested templates

Posted by Hermod Opstvedt <he...@opstvedt.com>.
Hi

In order for this to work, you need the following:

<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']}" /> 
	</symbols> 
</component>
	
<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>

Then in /templates/column_template.html you must have the symbols
@left_column and @right_column defined and in /templates/main_template.html
you must have @content defined

Take a look at the tutorials here:

[1] http://wiki.apache.org/shale/ShaleAndClayTutorial
[2] http://wiki.apache.org/shale/CreatingClayComponents

Hermod


-----Opprinnelig melding-----
Fra: JS Portal Support [mailto:support@jsportal.com] 
Sendt: 10. april 2007 13:23
Til: user@shale.apache.org
Emne: 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>

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