You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mlabs <ml...@gmail.com> on 2011/07/27 09:20:24 UTC
resource problem..
I declare a base markup page like so:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>My Wicket App</title>
<link rel="stylesheet" type="text/css"
href="resources/com.mycompany.webconsole.app.WebConsoleApplication/resources/style.css"/>
</head>
and I have my style.css file in a folder under the app folder that contains
the WebConsoleApplication class...
the CSS doesn't seem to get picked up...
examining the rendered page in firebug I see that the href has been
magically changed to :
<link rel="stylesheet" type="text/css"
href="../resources/com.mycompany.webconsole.app.WebConsoleApplication/resources/style.css"/>
the '../' is screwing me up here but I have no idea why it gets rendered
like that....
any ideas?
apologies in advance if this is a dumb question....
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/resource-problem-tp3697765p3697765.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: resource problem..
Posted by eugenebalt <eu...@yahoo.com>.
In the HTML, it would like this:
<html>
<head>
<title>Log In</title>
<wicket:link>
<link wicket:id="stylesheet"/>
</wicket:link>
</head>
<body>
So the WicketID CSS placeholder is where you would normally put a static CSS
declaration. Note the <wicket:link> around it.
Second, in Java,
add(new StyleSheetReference("stylesheet", SomeClass.class, "main.css"));
where SomeClass.java resides in the same folder as the file (in my case
"main.css").
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/resource-problem-tp3697765p3705659.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: resource problem..
Posted by mlabs <ml...@gmail.com>.
can you elaborate on that quick solution ? i'm getting errors about not
finding the wicket:id .. the stylesheet link was in the HEAD section .. do I
need to move that? if not, how do I add the link on the java side?
TIA
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/resource-problem-tp3697765p3705048.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: resource problem..
Posted by eugenebalt <eu...@yahoo.com>.
A quick solution, in case anyone's interested:
1) In your HTML: replace your stylesheet reference as below.
<wicket:link>
<link wicket:id="stylesheet"/>
</wicket:link>
2) In your Java:
add(new StyleSheetReference("stylesheet", SomeClass.class, "file.css"));
3) The .CSS file and the SomeClass.java must be in the same folder. Replace
with any class which resides in the same folder as the .CSS file.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/resource-problem-tp3697765p3700056.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: resource problem..
Posted by eugenebalt <eu...@yahoo.com>.
Sorry, but where should this renderHead() be overridden? I am working with a
WebPage, and I couldn't find an overridable method there.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/resource-problem-tp3697765p3699932.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: resource problem..
Posted by Martin Grigorov <mg...@apache.org>.
Use
#renderHead(IHeaderResponse response) {
response.renderCssReference(new
PackageResourceReference(WebConsoleApplication.class,
"resources/style.css"));
}
On Wed, Jul 27, 2011 at 10:20 AM, mlabs <ml...@gmail.com> wrote:
> I declare a base markup page like so:
>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
> <title>My Wicket App</title>
> <link rel="stylesheet" type="text/css"
>
> href="resources/com.mycompany.webconsole.app.WebConsoleApplication/resources/style.css"/>
> </head>
>
> and I have my style.css file in a folder under the app folder that contains
> the WebConsoleApplication class...
>
> the CSS doesn't seem to get picked up...
>
> examining the rendered page in firebug I see that the href has been
> magically changed to :
> <link rel="stylesheet" type="text/css"
>
> href="../resources/com.mycompany.webconsole.app.WebConsoleApplication/resources/style.css"/>
>
> the '../' is screwing me up here but I have no idea why it gets rendered
> like that....
>
> any ideas?
>
> apologies in advance if this is a dumb question....
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/resource-problem-tp3697765p3697765.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
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org