Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Resource References via ResourceBundles

$
0
0
Hello all,

Using wicket 6.12.0
I am trying to reference a CSS using
getResourceBundles().add[Css]Bundle(...) but I cannot make it work, even in
a simple quickstart: I do not have any reference in the output html

I read the post bellow but it did not helped me either (or I really missed
something...)
http://apache-wicket.1842946.n4.nabble.com/Referencing-CSS-resources-td4662753.html

The code simply looks like:

/**
* @see org.apache.wicket.Application#init()
*/
@Override
public void init()

super.init();

// try #1
this.getResourceBundles().addCssBundle(WicketApplication.class,
"mystyles", new CssResourceReference(WicketApplication.class,
"mystyles.css"));

// try #2
this.getResourceBundles().addCssBundle(MyReference.class,
"mystyles", new MyReference());

// try #3
this.getResourceBundles().addBundle(MyReference.getBundle());

static class MyReference extends CssResourceReference

private static final long serialVersionUID = 1L;

public static HeaderItem getBundle()

return CssHeaderItem.forReference(new MyReference()) ;

public MyReference()

super(MyReference.class, "mystyles.css");

I also tried with a dedicated MyReference class (meaning not an inner class)
The css file is located in the resource folder at the same level of
WicketApplication
So, I do not see what is missing here...

Many thanks in advance!
Sebastien.

Viewing all articles
Browse latest Browse all 5648

Trending Articles