Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added anchor link to section at bottom of page.

...

Since Tapestry 5.4.2, you can also easily invoke server-side event handlers using the @PublishEvents annotation and the t5/core/ajax JavaScript function, as explained in the "Invoking server-side event handler methods from JavaScript" section below.

Zones

Zones are Tapestry's approach to performing partial page updates. A Zone component renders as an HTML element, typically a <div>, and serves as a marker for where dynamically-updated content should be replaced. A zone is recognizable in the DOM because it will have the attribute data-container-type=zone. The client-side support for Zones is keyed off of this attribute and value.

...

You can return an object array, a list, even a single object. You may return objects instead of strings ... and toString() will be used to convert them into client-side strings.

Invoking server-side event handler methods from JavaScript
Anchor
invoking-server-side-event-handler-methods-from-javascript
invoking-server-side-event-handler-methods-from-javascript

Tapestry 5.4.2 introduced an API which makes it easy for server-side events to be invoked from JavaScript. On the server-side, you first need to annotate the event handler methods you want to expose with the @PublishEvent annotation. Then, in JavaScript, all you need to do is to call the existing existing t5/core/ajax function function, but with slightly different parameters.

...