I have a little problem with image relative path and not-mounted page in Wicket.
Take this code inside a generic Page (ex MyPage.java):
final DatePicker<Date> date = new DatePicker<Date>("date",true);
date.setButtonImage("img/calendar.gif");
img directory is stored inside WebContent directory.
The image is not correctly showed unless I mount the page in WebApplication. Without mounting the page, the relative url has to be considered starting from the java class path.
How Can I build the correct image url from WebContent without mounting the page?
Thanks
If you need the path you can use
date.setButtonImage(UrlUtils.rewriteToContextRelative("img/calendar.gif", getRequestCycle()));
That's how ContextImage works. If your DatePicker would accept another component as the image you could use this class directly.