You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Marcin Gut <ma...@yahoo.com> on 2005/04/16 18:17:35 UTC

Reusing page and component specifications

Hi everyone. I'm new to Tapestry and wondering how I
can have one, reusable page specification with
multiple HTML templates applied to it based on some
request-time parameters. The specific scenario is a
"home" page, where I want to have a different HTML
template for each "virtual" host. Right now I have to
create a separate set of identical .page files for
each host (i.e., Host1Home.page, Host2Home.page, ...),
and have some logic to select the right page when the
request comes in. I'd like to just have one Home.page
but select the HTML template for it dynamically, which
would be much cleaner.

Also wondering how I could do the same for components
(i.e., reuse the .jwc specification with multiple HTML
templates).

Thank you very much for any insights.

Best regards,
Marcin


		
__________________________________ 
Do you Yahoo!? 
Plan great trips with Yahoo! Travel: Now over 17,000 guides!
http://travel.yahoo.com/p-travelguide

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


Re: Reusing page and component specifications

Posted by Michael Henderson <mh...@mac.com>.
Hi,

I'm sure that there is a HiveMind way of doing this in Tapestry 4.0 but 
in 3.1 you need to create a template resolver delegate as a 'last 
resort' for Tapestry to locate a template. If you leave the templates 
out of the normal Tapestry template search path the delegate will be 
asked to resolve the template. Tapestry does not cache components and 
pages provided by the delegate, so your delegate will be asked to 
provide the page or component each time it is required. This allows you 
to return different templates, or auto-generated templates, etc, as you 
need.

This example shows a similar  method for customizing specification 
resolution:

http://www.behindthesite.com/blog/C1931765677/E1985935740/index.html


and this page provides some more detail:

http://jakarta.apache.org/tapestry/current/UsersGuide/configuration.html


MIke


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