Wicket JavaScript is not getting reflected

375 views Asked by At

I am facing a weird behavior in the wicket pages of the below hierarchy.

RootPage with few Abstract tabs added and In few Abstract tabs, based on the use case we have TabbedPanel of wicket UI Jquery. like this http://www.7thweb.net/wicket-jquery-ui/tabs/TabbedPanelPage?2. To navigate between tabs, I use AjaxTabbedPanel.

Issue1: Even the Default Jquery file is getting added to the page. But the UI components are not rendered with respect to Jquery

<script type="text/javascript" src="./wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-2.2.4-ver-F9EE266EF993962AD59E804AD9DEBE66.js"></script>
<script type="text/javascript" src="./wicket/resource/com.googlecode.wicket.jquery.ui.resource.JQueryUIResourceReference/jquery-ui-ver-0A819924D70A18322660DEE759225D2B.js"></script>

To overcome the above issue I have added the Jquery file by overriding renderHead method in RootPage. which only works on manual page refresh.

RootPage.renderHead:

@Override
public void renderHead(IHeaderResponse response){
 super.render(response);
 response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(RootPage.class, "jquery.min.js")));
 response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(RootPage.class, "jquery-ui.min.js")));
}

Issue2: But since I made Ajax to navigate between tabs, refreshing page usingsetResponsePage() seems to be an unexpected way.

To solve the Issue1, I explicitly added jquery which lead to another problem of an explicit refresh.

Am I missing anything in the Issue1 which can solve the issue? or Is there any way to refresh only my panels? to fix Issue2

1

There are 1 answers

1
martin-g On

Why do you contribute jquery.js yourself?

I'm not sure whether this is the cause of your problem but since Wicket also adds jQuery to the DOM I think you might have Javascript errors. Check the browser's DevTools console.