开发者

wicket (1.5) - Load different JS for development/deployment

I want to have so开发者_开发技巧mething like the following.

<head>
   <% if deployment == true %>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
   <% else %>
   <script src="js/lib/ref/jquery-1.6.2.js"></script>
   <% endif %>       
</head>

How can I do this in wicket?

Update:

Sorry, I was simplifying. Actually I want to include this just before the close body tag.


You can make your WebPage class implement the IHeaderContributer interface.

Then your class can override the following method

public void renderHeader(IHeaderResponse response) {
    if (deployment) {
        response.renderJavascriptReference("https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js");
    }
    else {
        response.renderJavascriptReference("js/lib/ref/jquery-1.6.2.js");
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜