...
Code Block | ||||
---|---|---|---|---|
| ||||
@Inject private Request request; @InjectComponent private Zone myZone; ... Object onClickFromSomeLink() { return myZone.getBody(); // AJAX request, return zone's own body } |
...
The possible return values are:
- A Block or Component to render as the response. The response will be a JSON hash, with a "content" key whose value is the rendered markup. This is the basis for updates with the Zone component.
- The zone's own body
- A JSONObject or JSONArray, which will be sent as the response.
- A StreamResponse, which will be sent as the response.
- A Link, which will send a redirect to the client.
- A page name (as a String), or a page class, or a page instance, which will send a redirect to the indicated page.
Graceful Degradation
Users who do not have JavaScript enabled may click EventLinks (or ActionLinks, or Forms) that are configured to update a Zone. When that occurs, the request will still be sent to the server, but Tapestry will handle it as a traditional request.
...
You may override DIV.t-autocomplete-menu UL
to change the main look and feel, DIV.t-autocomplete-menu LI
for a normal item in the popup list, and DIV.t-autocomplete-menu LI.selected
for the element under the cursor (or selecting using the arrow keys).
Your own Ajax Components
A study of the Autocomplete mixin's source code should be very helpful: it shows how to ask the ComponentResources object to create a link.
The key part is the way Tapestry invokes a component event handler method on the component.
For an Ajax request, the return value from an event handler method is processed differently than for a traditional action request. In an normal request, the return value is the normally name of a page (to redirect to), or the Class of a page to redirect to, or an instance of a page to redirect to.
For an Ajax request, a redirect is not sent: any response is rendered as part of the same request and sent back immediately.
The possible return values are:
...
.