Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Apache Wicket load jquery for all pages

Tags:

wicket

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.

like image 637
thoredge Avatar asked Feb 25 '13 12:02

thoredge


1 Answers

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.

like image 170
Christoph Leiter Avatar answered Sep 28 '22 06:09

Christoph Leiter