You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jim Roycroft <ji...@codesilver.ca> on 2007/02/06 20:50:49 UTC
RE: Changing the default location of the component template
Was there something else to this? Any changes to the pages that use the
component? I cannot get this to work.
I presume you meant "getTemplate()" as opposed to "get$template()".
Khan, Hatim wrote:
>
> Ok, it turns out that I can do the following to change the location of a
> custom component template:
>
> @ComponentClass(allowBody = true, allowInformalParameters = false)
> public abstract class Border extends BaseComponent {
> @Asset("context:/WEB-INF/component/my-border.html")
> public abstract IAsset get$template();
> }
>
>
> --------------------------------------------------------------------------------
>
> Sent: Tue 11/28/2006 3:59 PM
> To: users@tapestry.apache.org
> Subject: Changing the default location of the component template
>
> Hello,
> I am trying to use annotations instead of .jwc files.
> I have a custom BaseComponent with a template. However, I want the
> template to be located under WEB-INF/component/mycomponent.html.
>
> Going through some of the code, I found out that you can specify the
> location of the template using an asset named '$template'. This is
> great, but how can I use it with annotation?
>
> The only solution that I can think of is introducing a new annotation
> say '@AssetTemplate("context:/WEB-INF/component/mycomponent.html")' .
> This annotation will simply insert an asset named '$template' with the
> given value.
>
> I have seen other solutions using the ISpecificationResolverDelegate,
> (http://wiki.apache.org/tapestry/PagesAndComponentsInWEB-INF), but the
> Wiki is saying that there is a bug
> (http://issues.apache.org/jira/browse/TAPESTRY-894) that will prevent
> the delegate solution from working correctly?
>
> Any advice will be greatly appreciated.
>
> Thanks
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
--
View this message in context: http://www.nabble.com/Changing-the-default-location-of-the-component-template-tf2720951.html#a8832982
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Changing the default location of the component template
Posted by andyhot <an...@di.uoa.gr>.
Better not use the $template asset - it's completely undocumented
and could go away without notice.
Go with the wiki suggestion - you can easily invent variations on it, i.e.
we like keeping the templates (for both pages and components) in the
same folder
as the .java files - a ClasspathSpecResolverDelegate and a
ClasspathComponentSpecResolver
are enough to do the trick.
fyi, TAPESTRY-894 has been fixed
Jim Roycroft wrote:
> Nevermind, get$template() was absolutely correct! Man that's ugly....
>
>
>
> Jim Roycroft wrote:
>
>> Was there something else to this? Any changes to the pages that use the
>> component? I cannot get this to work.
>>
>> I presume you meant "getTemplate()" as opposed to "get$template()".
>>
>>
>>
>> Khan, Hatim wrote:
>>
>>> Ok, it turns out that I can do the following to change the location of a
>>> custom component template:
>>>
>>> @ComponentClass(allowBody = true, allowInformalParameters = false)
>>> public abstract class Border extends BaseComponent {
>>> @Asset("context:/WEB-INF/component/my-border.html")
>>> public abstract IAsset get$template();
>>> }
>>>
>>>
>>> --------------------------------------------------------------------------------
>>>
>>> Sent: Tue 11/28/2006 3:59 PM
>>> To: users@tapestry.apache.org
>>> Subject: Changing the default location of the component template
>>>
>>> Hello,
>>> I am trying to use annotations instead of .jwc files.
>>> I have a custom BaseComponent with a template. However, I want the
>>> template to be located under WEB-INF/component/mycomponent.html.
>>>
>>> Going through some of the code, I found out that you can specify the
>>> location of the template using an asset named '$template'. This is
>>> great, but how can I use it with annotation?
>>>
>>> The only solution that I can think of is introducing a new annotation
>>> say '@AssetTemplate("context:/WEB-INF/component/mycomponent.html")' .
>>> This annotation will simply insert an asset named '$template' with the
>>> given value.
>>>
>>> I have seen other solutions using the ISpecificationResolverDelegate,
>>> (http://wiki.apache.org/tapestry/PagesAndComponentsInWEB-INF), but the
>>> Wiki is saying that there is a bug
>>> (http://issues.apache.org/jira/browse/TAPESTRY-894) that will prevent
>>> the delegate solution from working correctly?
>>>
>>> Any advice will be greatly appreciated.
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>
>
--
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: Changing the default location of the component template
Posted by Jim Roycroft <ji...@codesilver.ca>.
Nevermind, get$template() was absolutely correct! Man that's ugly....
Jim Roycroft wrote:
>
> Was there something else to this? Any changes to the pages that use the
> component? I cannot get this to work.
>
> I presume you meant "getTemplate()" as opposed to "get$template()".
>
>
>
> Khan, Hatim wrote:
>>
>> Ok, it turns out that I can do the following to change the location of a
>> custom component template:
>>
>> @ComponentClass(allowBody = true, allowInformalParameters = false)
>> public abstract class Border extends BaseComponent {
>> @Asset("context:/WEB-INF/component/my-border.html")
>> public abstract IAsset get$template();
>> }
>>
>>
>> --------------------------------------------------------------------------------
>>
>> Sent: Tue 11/28/2006 3:59 PM
>> To: users@tapestry.apache.org
>> Subject: Changing the default location of the component template
>>
>> Hello,
>> I am trying to use annotations instead of .jwc files.
>> I have a custom BaseComponent with a template. However, I want the
>> template to be located under WEB-INF/component/mycomponent.html.
>>
>> Going through some of the code, I found out that you can specify the
>> location of the template using an asset named '$template'. This is
>> great, but how can I use it with annotation?
>>
>> The only solution that I can think of is introducing a new annotation
>> say '@AssetTemplate("context:/WEB-INF/component/mycomponent.html")' .
>> This annotation will simply insert an asset named '$template' with the
>> given value.
>>
>> I have seen other solutions using the ISpecificationResolverDelegate,
>> (http://wiki.apache.org/tapestry/PagesAndComponentsInWEB-INF), but the
>> Wiki is saying that there is a bug
>> (http://issues.apache.org/jira/browse/TAPESTRY-894) that will prevent
>> the delegate solution from working correctly?
>>
>> Any advice will be greatly appreciated.
>>
>> Thanks
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
--
View this message in context: http://www.nabble.com/Changing-the-default-location-of-the-component-template-tf2720951.html#a8832987
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org