Hello,

I am trying to defined shared images in a Wicket application.

In my prokect, the image file "help.gif" is located under the
src/main/java/com/foo/ folder of my project. I have created an empty
class called Images.

package com.foo;
public class Images {
}

In the init() method of my web-application, I add help.gif as a shared resource:

public class MyApplication extends WebApplication {


  @Override
  protected void init() {
    ...
    PackageResource pr = PackageResource.get(Images.class, "help.gif");
    sharedResources.add("help.gif", pr);
  }
}

In markup, I attempt to access the images as

   <wicket:link>
     <td><img src="/resources/help.gif" align="top"/></td>
   </wicket:link>

Unfortunately, this does not seem to work. However, the following
markup works just fine but it's too cumbersome to write.

   <wicket:link>
     <img src="resources/org.apache.wicket.Application/help.gif"/>
   </wicket:link>

Reading page 229 of the Wicket in Action book, I would have thought
that the "/resources/help.gif" reference would have worked. Quoting
from the book:

  The resource is then available through a stable URL (/resources/discounts),
  independent of components. (page 229)

What is the idiomatic way in Wicket to reference shared images?

Many thanks in advance for your response,

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to