You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Kersten <Ma...@mercateo.com> on 2008/02/29 10:13:48 UTC

T5: Assets, resources and file path

Hi there,
 
  It seams I do not understand the asset-idea fully. The problem of referencing images and scripts in source (e.g for including GWT + Ext components) seams to be quite tricky since tapestry uses the path (url) of pages to add additional parameters. So I stuck with path issues when using relative paths all day long.
 
Example:
 
relative: <img src="images/png1.png"> - does not work with different parameters (/view vs. /view/0)
absolute: <img src="/contextName/images/png1.png"> - works
 
Since hard coding the context name (absolute way) makes the code blow when renaming the project I would like to consider it bad style. So using a global property (visible to all pages and components) seams the way to go.
 
global: <img src="${contextRoot}/images/png1.png">
 
This context root I can grab from ServletContext via requestGlobals. This would polute my components and pages so I am looking for a global property definition I can use within the templates just like the "context:" or "${tapestry}" alias. Saidly this alias service does not work for templates as far as I know.
 
Is there any way around? I dont like to extend my components and pages just for the sake knowing the contextName without injecting request globals every time (at least on page level - using inherit for component base parameter).
 
Also I need this base for setting up generated html within a GWT component.
 
 
Thanks,
 
Martin (Kersten)

AW: T5: Assets, resources and file path

Posted by Martin Kersten <Ma...@mercateo.com>.
Works like a charm thanks. I wasn't aware of this one. Thanks.

-----Ursprüngliche Nachricht-----
Von: Thiago HP [mailto:thiagohp@gmail.com] 
Gesendet: Freitag, 29. Februar 2008 13:24
An: Tapestry users
Betreff: Re: T5: Assets, resources and file path

Have you tried <img src="${asset:context:images/png1.png}"/>?

--
Thiago

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


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


Re: T5: Assets, resources and file path

Posted by Thiago HP <th...@gmail.com>.
Have you tried <img src="${asset:context:images/png1.png}"/>?

-- 
Thiago

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