please, is there a way how to achieve this ?
- static image with url defined in HTML relatively to the html page
- adding the AJAX link to it to make some AJAX action
1st I had this:
<wicket:link>
<img src="images/test.jpg">
</wicket:link>
-> image is found and displayed, the url was automatically resolved to :
<img src="resources/my.package.MyClass/images/test.jpg" >
2nd I added the AJAX action:
<wicket:link>
<img src="images/test.jpg" wicket:id="sayHelloImage">
</wicket:link>
add(new AjaxLink("sayHelloImage") {
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("alert('Hello!')");
}
});
-> the result is that the action works, but the image url is no longer resolved, image is not found, the url stayed the same:
img src=”images/test.jpg” …
I know that I can load the image dynamically from the class like this:
ResourceReference image = new ResourceReference(MyClass.class,”images/test.jpg”);
but this is what I don’t want to, I would prefer to set the image url in html.
Thank you,
with kind regards,
-josef-
<img> can’t be used to produce a link (AjaxLink).
Try this: