If you want to add a reference to a CSS file, you can do it like this:
add(HeaderContributor.forCss(new
ResourceReference(YourBasePage.class, "file.css",
getWebSession().getLocale(), getWebSession().getStyle()));
That will add a <link> in the HTML.
If you wanted to add CSS directly from your class, you could also do this:
add(new HeaderContributor(new IHeaderContributor()
{
private static final long serialVersionUID = 1L;
public void renderHead(IHeaderResponse response)
{
response.renderString("<style>head, body { background-color:
black; }</style>");
}
}));
Long story short, there's a myriad of ways, each having pros / cons - it
will depend on your situation.
You could, of course, also read this wiki page and get a lot more
information about CSS / JS in Wicket:
http://cwiki.apache.org/WICKET/javascript-and-css-support.html
--
Jeremy Thomerson
http://www.wickettraining.com
On Fri, May 16, 2008 at 12:50 AM, Mathias P.W Nilsson <[EMAIL PROTECTED]>
wrote:
>
> Sorry... a little early. Not chaning, changing.
>
> I have looked at HeaderContributor() but that requires a css file and I
> want just to append like SimpleAttributeModifier but the html, body can't
> have the same id and If I add a wicket:id on body I get exception when
> extending the wicket page.
> --
> View this message in context:
> http://www.nabble.com/chaning-background-tp17268044p17268081.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>