andunslg
andunslg

Reputation: 791

How to add on-line CSS reference in Apache Wicket Web Applications?

Currently I am using this code to add a CSS resource to my Wicket Web Application,

this.add(new CssResourceRefernce(FontAwesomeStyleSheetResourceReference.class, "css/font-awesome.css"));

I want to add this same CSS file as a on-line resource to my application. Using HTML I can do ti like this,

<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">

What is the 'Wicket' way of doing this task?

Upvotes: 1

Views: 1806

Answers (2)

Tom
Tom

Reputation: 4093

In Wicket 6.x, you can override renderHead() to include a CSS resource via URL like this:

@Override
public void renderHead(IHeaderResponse response){
  response.render(CSSReferenceHeaderItem.forUrl("url_to_your_css.css"));
}

Upvotes: 5

Robert Niestroj
Robert Niestroj

Reputation: 16131

You can do it like @Tom did it or what you are looking after is the UrlResourceReference that is

A ResourceReference that can be used to point to a resource by using an Url. For example to a resource residing in a CDN (Content Delivering Network) or context relative one.

Upvotes: 0

Related Questions