Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added a few mentions of EventLink

...

Notice that Chooser.tml contains an ActionLink component. When rendered on the page, the ActionLink component creates a link with an action URL, which in this case might look like http://localhost:8080/chooser.select/3

...

Code Block
java
java
  @OnEvent(component = "select")
  void valueChosen(int value)
  {
    this.value = value;F
  }

Tapestry does two things here:

...

The value attribute of the OnEvent annotation is the name of the event to match. The default event type is "action"; the ActionLink and Form components each use this event type. Alternatively, we could have used an EventLink component, in which case the name of the event is determined by the element's ID, rather than being "action".

If you omit the component part of the OnEvent annotation, then you'll receive notifications from all contained components, possibly including nested components (due to event bubbling).

...

For page navigation events (originating in components such as EventLink, ActionLink and Form), the value returned from an event handler method determines how Tapestry will render a response.

...

If the name of a page, or a page class or page instance, is returned, then a render request URL will be constructed and sent to the client as a redirect to that page.

In the case of an Ajax request to update a zone, the component event handler will return the new zone body, typically via an injected component or block.

See Page Navigation for other return values.

...

The context values (the context parameter to the EventLink or ActionLink component) can be any object. However, only a simple conversion to string occurs. (This is in contrast to Tapestry 4, which had an elaborate type mechanism with the odd name "DataSqueezer".)

...

If you have multiple context values (by binding a list or array of objects to the ActionLink's context parameter of the EventLink or ActionLink), then each one, in order, will be added to the URL.

...