one. you have to create an initializer and bind the image as a package resource:
public void init(Application application)
{
PackageResource.bind(application, Tree.class, "blank.gif");
...
}
the Tree.class acts as a scope - the image is assumed to be in the same package as the scope class.
the initializer is needed for clustering reasons. look at wicket.properties and Initializer code in wicket package.
two. you must create a resource reference to your image:
/** Blank image. */
public static final ResourceReference BLANK = new PackageResourceReference( Tree.class, "blank.gif");
after this you can create a url for the image in the package like so RequestCycle.get().urlFor(BLANK);
hope this helps,
-Igor
On 3/14/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:
I am writing code that will be shared between two web applications. The
common code will be packaged in a .jar to be included by both web
applications.
One common component has a requirement to display an image whose
filename (or some other handle) it takes as a parameter. The images
that will be passed to this component to display are different for the
two web applications. Therefore, my image files must reside separately
from the code which constructs the wicket.markup.html.image.Image
component.
The constructor for wicket.markup.html.image.Image can take a string
representing the image's file name. In all of the examples, the image
file exists in the same directory as the component that creates the
Image component. If the image exists in some other arbitrary location,
what are the rules for absolute or relative path addressing of the image
filename?
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
