'Make Apache Wicket load jquery for all pages

I've got some javascript going on on my pages in addition to Wickets use. However, Wicket only loads jquery on pages where it sees that it is needed. Is there any way to make Wicket load jquery on all pages?

I'd hate to include jquery a second time.



Solution 1:[1]

Yes. You can include it in your base page so that it is available for all pages:

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);

    response.render(JavaScriptHeaderItem.forReference(getApplication().getJavaScriptLibrarySettings()
        .getJQueryReference()));  
}

Wicket is smart enough to not include the reference multiple times if it is requested elsewhere too.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 syl-oh