THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
add(HeaderContributor.forCss(MyClass.class, "style.css")); |
In Wicket 1.4 HeaderContributor.forCss() is deprecated, you can use the code below:
Code Block |
---|
add(CSSPackageResource.getHeaderContribution(MyClass.class, "style.css"));
|
You can add this to any component. Header contribution of style.css relative to MyClass will automatically be taken care off and double contributions will be filtered (ignored). This is my favorite, as you don't need components that have their own markup to do this, you can do this 'inside or outside' of a component, and it is just less typing.
In Wicket 1.5, you can use the code below:
Code Block |
---|
@Override public void renderHead(IHeaderResponse response) { response.renderJavaScriptReference(new PackageResourceReference(MyClass.class, "mypackage/myscript.js")); response.renderCSSReference(new PackageResourceReference(MyClass.class, "mypackage/mystyle.css")); } |