Make Apache Wicket load jquery for all pages
Asked Answered
E

1

12

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.

Echinate answered 25/2, 2013 at 12:1 Comment(0)
F
19

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.

Fourth answered 25/2, 2013 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.