GitHub

User guide

Ajax and JavaScript

Update parts of a page without reloading it, and work with JavaScript.

How-to guides

Directions for a specific goal.

  • Update components with Ajax Re-render components, show hidden ones, refresh lists and run JavaScript in response to an Ajax request.
  • Show that a request is running Show a busy indicator while an Ajax request runs, with the indicating components, your own component or your own spinner element.
  • Block the page while a request runs Wicket 11+ Cover the page or one component with a veil during Ajax requests, so a second click cannot send the same request twice.
  • Change how an Ajax request is sent Override updateAjaxAttributes to throttle requests, send them as POST, pass extra parameters, drop outdated ones or stop the browser's default action.
  • React to Ajax requests in JavaScript Run your own JavaScript before, during and after Ajax requests, for one component with a call listener or for the whole page with global events.
  • Use Ajax on stateless pages Make Ajax components and behaviors stateless with getStatelessHint, so a page such as a login page keeps working without a stored page instance.
  • Write Ajax handlers as lambdas Create Ajax behaviors from lambdas with their static factory methods instead of anonymous subclasses, and do the same for Ajax links and buttons.
  • Wrap a JavaScript widget in a component Package a JavaScript library with a component, initialize it with the component's markup id, keep it working after Ajax updates and call back to the server.
  • Run Ajax without jQuery Wicket 11+ Switch the application to Wicket's plain JavaScript Ajax implementation, so pages no longer download jQuery.

Reference

The classes, tags and settings, described.

  • Ajax components The Ajax components in wicket-core and wicket-extensions, what each does and which callback you override.
  • Ajax behaviors The Ajax behaviors and call listeners in wicket-core and wicket-extensions, the callback each one calls and its lambda factory method.

Explanation

Why Wicket works the way it does.

  • How Wicket Ajax works What happens between a click in the browser and the updated components on the page, and why components need a markup id.