Thanks,
this is exactly what i was looking for,
Cheers,
Gertjan
On Mon, 2005-10-10 at 16:29 +0000, Kent Tong wrote:
> Gertjan Assies <gertjan <at> assies.nu> writes:
>
> >
> >
> > Hi,
> >
> > I have the following definitions in my page-specification
> >
> > <property name="file" />
> > <property name="selectedFile" persist="session"/>
> >
> > <component id="icon" type="Image">
> > <binding name="image" value="assets.icon"/>
> > </component>
> > <asset name="icon" path="img/item.png" />
> >
> > this is based on the tacos tree component
> >
> > I want to make the icon asset dynamic, based on the file property
> > (have thumbnails of pictures as icons in the tree)
> > but changing the image binding to
> > <binding name="image" value="ognl:file.path">
>
> Try:
>
> <binding name="image" value="dynamicAsset"/>
>
> In your java class:
>
> @InjectObject("service:tapestry.globals.WebRequest")
> public abstract WebRequest getWebRequest();
>
> @InjectObject("service:tapestry.globals.ServletContext")
> public abstract ServletContext getServletContext();
>
> public IAsset getDynamicAsset() {
> return new ContextAsset(
> getWebRequest().getContextPath(),
> new ContextResource(getServletContext(), getFile().getPath()),
> null);
> }
>
> --
> Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]