You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Suraj Chandran <ch...@gmail.com> on 2011/06/02 20:04:29 UTC

Images referencing in CSS with Wicket

Hey guys,

I am referring to an image in CSS as follows:
body {
    background-image: url("*images/theme/sky.jpg*");
}

But the browser can't load the url. But instead if I place the full path in
the url, then image loads up just fine.

I read a similar problem on SO here:
http://stackoverflow.com/questions/5279232/images-referencing-in-css-with-wicket-for-hundreds-of-images
In the end of the answer there: ".... Wicket doesn't support it somehow
internally. I am quite surprised. For mounting bookmarkable pages for the
whole package we have mount(path, packageName), but for resources nothing
(if I understand it right)."

Can someone tell me what is the preferred way of approaching this problem.

This mounting thing is very confusing for me. Can someone point me to the
best tutorial about urls/mounts/resources in wicket. I am using 1.5rc4.2

Thanks a lot,
Suraj.

Re: Images referencing in CSS with Wicket

Posted by Igor Vaynberg <ig...@gmail.com>.
if you want to reference images from css the images have to live next
to the css file. so if your css is in webapp, the images have to be
based in webapp, but if your css lives in a java package the images
have to live there as well. this way relative urls work.

-igor

On Thu, Jun 2, 2011 at 11:04 AM, Suraj Chandran <ch...@gmail.com> wrote:
> Hey guys,
>
> I am referring to an image in CSS as follows:
> body {
>    background-image: url("*images/theme/sky.jpg*");
> }
>
> But the browser can't load the url. But instead if I place the full path in
> the url, then image loads up just fine.
>
> I read a similar problem on SO here:
> http://stackoverflow.com/questions/5279232/images-referencing-in-css-with-wicket-for-hundreds-of-images
> In the end of the answer there: ".... Wicket doesn't support it somehow
> internally. I am quite surprised. For mounting bookmarkable pages for the
> whole package we have mount(path, packageName), but for resources nothing
> (if I understand it right)."
>
> Can someone tell me what is the preferred way of approaching this problem.
>
> This mounting thing is very confusing for me. Can someone point me to the
> best tutorial about urls/mounts/resources in wicket. I am using 1.5rc4.2
>
> Thanks a lot,
> Suraj.
>

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