You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Benjamin Lorenz <be...@kapowtech.com> on 2010/11/16 16:35:27 UTC

Problem including CSS with CSSPackageResource

Hello,

I need to dynamically include different style sheet files for different browser types.

Trying to go with

    add(CSSPackageResource.getHeaderContribution("css/common.css"));

from by BasePage.java, which is the base class all my pages inherit from (net.myself.myproject.BasePage.java)

For some reason, the generated code is 

<link rel="stylesheet" type="text/css" href="../css/common.css" />

I cannot get rid of this (wrong!) "../" in the path. The layout in myapp.war is a very basic one:


/WEB-INF
/images
/css

I am calling my wicket application like this:

http://www.server.com/myapp

So, I can, by hand, reach my css by

http://www.server.com/myapp/css/common.css

But exactly this last path is impossible to create with wicket. I am wondering what is wrong with above code...

Thanks so much for your help!

Benjamin



Re: Problem including CSS with CSSPackageResource

Posted by lorenz2304 <ma...@benjaminlorenz.de>.
My problem is the wrong path that wicket generates: "../css/" instead of
"css/", which is what I need. 

../ points out of the webapp, which makes no sense at all.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Problem-including-CSS-with-CSSPackageResource-tp3045031p3065262.html
Sent from the Users forum 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: Problem including CSS with CSSPackageResource

Posted by Igor Vaynberg <ig...@gmail.com>.
packageresource is for reading files out of java packages. sounds like
your css files are in your webapp. see how ContextImage works, you
might have to write something similar to pull css files out of the
context.

-igor

On Tue, Nov 16, 2010 at 7:35 AM, Benjamin Lorenz
<be...@kapowtech.com> wrote:
> Hello,
>
> I need to dynamically include different style sheet files for different browser types.
>
> Trying to go with
>
>    add(CSSPackageResource.getHeaderContribution("css/common.css"));
>
> from by BasePage.java, which is the base class all my pages inherit from (net.myself.myproject.BasePage.java)
>
> For some reason, the generated code is
>
> <link rel="stylesheet" type="text/css" href="../css/common.css" />
>
> I cannot get rid of this (wrong!) "../" in the path. The layout in myapp.war is a very basic one:
>
>
> /WEB-INF
> /images
> /css
>
> I am calling my wicket application like this:
>
> http://www.server.com/myapp
>
> So, I can, by hand, reach my css by
>
> http://www.server.com/myapp/css/common.css
>
> But exactly this last path is impossible to create with wicket. I am wondering what is wrong with above code...
>
> Thanks so much for your help!
>
> Benjamin
>
>
>

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