I've not seen AssetResource - what is the advantage to using it like
this as opposed simply to injecting the asset?
lasitha wrote:
On Nov 19, 2007 2:37 PM, Doublel <[EMAIL PROTECTED]> wrote:
public void onActivate(String id){
if (lw.hnSunny.equals(bc.getLogWeather())){
this.weatherPath="logweath.gif";
...
@Inject
@Path("context:/images/"+ weatherPath )
private Asset trackback;
I want to implement image can dynamic by var weatherPath
Hello, i'd try injecting the AssetSource service directly into your
page/component and using it to look up the resource dynamically.
http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/services/AssetSource.html
I haven't tested this, but something like:
@Inject ComponentResources resources;
@Inject AssetSource assetSource;
Asset getTrackback() {
return assetSource.findAsset(
resources.getBaseResource(),
"context:/images/" + calculateWeatherPath(),
null);
}
It actually may work with just null for the first parameter (the
resource base) too.
Cheers,
lasitha
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]