You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by fachhoch <fa...@gmail.com> on 2009/03/27 22:22:10 UTC

images in root folder

I have my images in root folder , i dont want to change  their location ,
please suggest me how to load images using resource reference ? what is the
equivalent of  
request.getContextPath()\images\myimage.jpg    in wicket html page ? I dont
want to hard code my application context root  in html pages 
-- 
View this message in context: http://www.nabble.com/images-in-root-folder-tp22748451p22748451.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: images in root folder

Posted by Stephen Swinsburg <s....@lancaster.ac.uk>.
If you have an img tag, you can use a ContextImage to load an image  
relative to your webapp context.

ie

HTML
<img wicket:id="myimage" />

Java
add(new ContextImage("myimage", "path/to/your/image");

The path will be relative to your webapp, so if your images are  
deployed in the root of your webapp the path will just be "image.jpg".


cheers,
Steve


On 27/03/2009, at 9:22 PM, fachhoch wrote:

>
> I have my images in root folder , i dont want to change  their  
> location ,
> please suggest me how to load images using resource reference ? what  
> is the
> equivalent of
> request.getContextPath()\images\myimage.jpg    in wicket html page ?  
> I dont
> want to hard code my application context root  in html pages
> -- 
> View this message in context: http://www.nabble.com/images-in-root-folder-tp22748451p22748451.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>