You are mixing between creating assets and defining them.

The annotation is defining an asset, and what you probably want is create a new one on the fly.-

To do so, you need to inject one of the AssetFactory services from here, and use it to create one on the fly...

http://tapestry.apache.org/tapestry4/tapestry/hivedocs/module/tapestry.asset.html

Cheers,
Ron



Srinivas Yermal wrote:
Hi,

I am now a big fan of tapestry annotations since everything stays neatly in
one place, except in one area which still bothers me. I want to specify
assets like stylesheets and such in a Border component that can be used by
the rest of the pages and the whole app looks uniform and so on and so
forth.

But I also want to be able to change the stylesheet name at deploy time,
without having to recompile and redistribute the war file, in other words
bother the developers whenever I want to change it. So I thought may be I
can declare it as a key (stylesheet = css/mycss.css) in the
app.propertiesfile and pick it up in Border component.

@Asset("message:stylesheet") - This isnt working. I dont know whether its
supposed to.

I went ahead and tried this -
public IAsset getStylesheet() {
   return getAsset(getMessages().getMessage("stylesheet"));
}

However this code always returns null. I guess the asset needs to be
registered much ahead, (there is some code I see in AbstractComponent which
uses a map to store references of assets). So how am I supposed to setup
dynamic assets? Is there a way of creating assets when required? I remember
having read something about this but I am unable to find it. I would be
grateful if you could point me in the right direction.

Thanks,
Srini.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to