Have you tried using it in an img tag rather than println?  I.e.:

add(new Image("img", ref));

<img wicket:id="img" />

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, Apr 13, 2009 at 11:38 AM, Ryan LaHue <ryanlahue...@gmail.com> wrote:

> I'm having trouble getting ResourceReferences to work for some reason, and
> was hoping somebody could give me some pointers.  I'm using wicket 1.4.
>
> As a simple test I added a new page and put a "test.png" image in the same
> directory in my project.  My structure is like so:
> project
> |--src
> |----mypkg
> |------test
> |--------TestResource.java
> |--------test.png
> |--public_html
> |----images
> |------test.png
>
> Java class: mypkg.test.TestResource.java
> ...
>    ResourceReference ref = new ResourceReference(TestResource.class,
> "test.png");
>    System.out.println("Valid resource: " + (ref.getResource() != null));
> ...
>
> This always returns false.  I also tried putting the "test.png" in my
> public_html/images directory but no luck.  I don't seem to have any luck
> getting these Resources to load correctly, so I've had to resort to
> hardcoding my javascript references into my html files.  Anybody have any
> suggestions?  I've verified that all the files are being copied to my
> output
> classes folder.
>

Reply via email to