Here are another two options:
*** 1º Option ***
Use Any component like this:
<img jwcid="@Any" src="ognl:methodName"/>
In your page class you could create a method that returns the path to your
image.
*** 2º Option ***
Create context assets programatically.
Here is a utility method that will create a ContextAsset for a given path:
public IAsset getContextAsset(String path) {
ContextResourceLocation location = new ContextResourceLocation(
getRequestCycle().getRequestContext().getServlet()
.getServletContext(), path);
ContextAsset asset = new ContextAsset(location, new Location(location));
return asset;
}
*** Conclusion ***
The first choice is much simplier, but the second is better if you have to
internacionalize images.
On 7/9/05, Jelena Jovanovic <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> I need to include one or more images in a page
> that is dynamically created. Which images should
> be included in the page is determined during the
> runtime. Images that I work with are kept in a
> subdirectory of the context directory. However,
> the images collection is rather large and can
> increase during the program execution, so I can
> not enumerate those images as assets in the .page
> file. I saw that there are some classes that
> implement IAsset interface and I guess that I
> should use one of them, but I do not know how. Can
> anyone send a piece of code showing how to handle
> this problem?
>
>
> Regards,
>
> Jelena
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>