开发者

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

开发者 https://www.devze.com 2023-03-23 18:07 出处:网络
I want to have so开发者_开发技巧mething like the following. <head> <% if deployment == true %>

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

精彩评论

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