Currently I am using this code to add a CSS resource to my Wicket Web Application,
目前我正在使用此代码将CSS资源添加到我的Wicket Web应用程序,
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,
我想将这个相同的CSS文件作为在线资源添加到我的应用程序中。使用HTML我可以这样做,
<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?
什么是“Wicket”执行此任务的方式?
2 个解决方案
#1
5
In Wicket 6.x, you can override renderHead() to include a CSS resource via URL like this:
在Wicket 6.x中,您可以通过URL覆盖renderHead()以包含CSS资源,如下所示:
@Override
public void renderHead(IHeaderResponse response){
response.render(CSSReferenceHeaderItem.forUrl("url_to_your_css.css"));
}
#2
0
You can do it like @Tom did it or what you are looking after is the UrlResourceReference that is
你可以像@Tom那样做,或者你正在寻找的是UrlResourceReference
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.
可以使用Url指向资源的ResourceReference。例如,驻留在CDN(内容交付网络)或上下文相关的资源中的资源。
#1
5
In Wicket 6.x, you can override renderHead() to include a CSS resource via URL like this:
在Wicket 6.x中,您可以通过URL覆盖renderHead()以包含CSS资源,如下所示:
@Override
public void renderHead(IHeaderResponse response){
response.render(CSSReferenceHeaderItem.forUrl("url_to_your_css.css"));
}
#2
0
You can do it like @Tom did it or what you are looking after is the UrlResourceReference that is
你可以像@Tom那样做,或者你正在寻找的是UrlResourceReference
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.
可以使用Url指向资源的ResourceReference。例如,驻留在CDN(内容交付网络)或上下文相关的资源中的资源。