Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: document AjaxResponseRenderer as replacement for MultiZoneUpdate

...

From the event handler method, instead of returning a Block or a Component, return a multi-zone update:

Code Block
controlstrue
titleMultiple Zone Update (5.2)
linenumberstrue
  @Inject
  private Block searchResults;

  @Inject
  private Block statusBlock;

  Object onSuccessFromSearchForm()
  {
    searchHits = searchService.performSearch(query);

    message = String.format("Found %,d matching documents", searchHits.size());

    return new MultiZoneUpdate("results", searchResults).add("status", statusBlock);
  }

The above will work in Tapestry 5.3, but MultiZoneUpdate is deprecated and replaced:

Code Block
controlstrue
titleMultiple Zone Update (5.2)
linenumberstrue
  @Inject
  private Block searchResults;

  @Inject
  private Block statusBlock;

  @Inject
  private AjaxResponseRenderer ajaxResponseRenderer;

  void onSuccessFromSearchForm()
  {
    searchHits = searchService.performSearch(query);

    message = String.format("Found %,d matching documents", searchHits.size());

    ajaxResponseRenderer.addRender("results", searchResults).addRender("status", statusBlock);
  }

AjaxResponseRenderer adds other useful commands as well. It also has the advantage that a simple return value can be returned to render content for the Zone that triggered the request.

What's that weird number in the middle of the client ids after a Zone is updated?

...