简体   繁体   中英

adding .js.map files to page header in apache wicket-6.x

after adding a javascript file to my Wicket panel like so

renderJsHeaderItem(response, "js/jquery/dist/jquery.min.js");

I get an error in the javascript console along the lines of

GET http://localhost:9080/js/jquery/dist/jquery.min.map 404 (Not Found)

How would I add the map file to my Panel code? (same question for css.map)

Thanks!

Wicket 6 comes with jquery so you dont have to add it again. You should add javascript and css files in your base page, that way all of the pages that extend the base page will have these files available and you only have to add them in one file.

To add javascript or css in renderHead use:

JavaScriptHeaderItem.forUrl("js/jquery/dist/jquery.min.js");
CssHeaderItem.forUrl("css/style.css");

Example:

@Override
public void renderHead(IHeaderResponse response) {
  response.render(JavaScriptHeaderItem.forUrl("js/jquery/dist/jquery.min.js"));
  response.render(CssHeaderItem.forUrl("css/style.css"));
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM