Author: buildbot Date: Mon Mar 20 12:20:09 2017 New Revision: 1008681 Log: Production update by buildbot for tapestry
Modified: websites/production/tapestry/content/ajax-and-zones.html websites/production/tapestry/content/cache/main.pageCache Modified: websites/production/tapestry/content/ajax-and-zones.html ============================================================================== --- websites/production/tapestry/content/ajax-and-zones.html (original) +++ websites/production/tapestry/content/ajax-and-zones.html Mon Mar 20 12:20:09 2017 @@ -197,7 +197,7 @@ void onUpdateTime() currentTime = new Date();  ajaxResponseRenderer.addRender(timeArea); } </pre> -</div></div><p>That <code>onUpdateTime</code> method is just an ordinary Tapestry event handler, except that it uses an injected <code>AjaxResponseRenderer</code> to tell Tapestry what zone to update when the link is clicked.</p><p>Since Tapestry 5.4.2, you can also easily invoke server-side event handlers using the <code>@PublishEvents</code> annotation and the <code>t5/core/ajax</code> JavaScript function, as explained in the </p><h2 id="AjaxandZones-Zones">Zones</h2><p>Zones are Tapestry's approach to performing partial page updates. A <a class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Zone.html">Zone component</a> 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 <code>data-container-type=zone</code>. The client-side support for Zones is key ed off of this attribute and value.</p><p>Starting in Tapestry 5.4 you can use any HTML element in your template as a zone marker, by passing its client-side id to the two-argument version of the addRender method.</p><p><span style="line-height: 1.4285715;">A Zone updated can be triggered by an EventLink, ActionLink or Select component, or by a Form. All of these components support the <code>async</code> and/or <code>zone</code> parameters. Clicking such a link will invoke an event handler method on the server as normal ... except that a </span><em style="line-height: 1.4285715;">partial page response</em><span style="line-height: 1.4285715;"> is sent to the client, and the content of that response is used to update the Zone's <div> in place.</span></p><div class="navmenu" style="float:right; background:#eee; margin:3px; padding:0 1em"> +</div></div><p>That <code>onUpdateTime</code> method is just an ordinary Tapestry event handler, except that it uses an injected <code>AjaxResponseRenderer</code> to tell Tapestry what zone to update when the link is clicked.</p><p>Since Tapestry 5.4.2, you can also easily invoke server-side event handlers using the <code>@PublishEvents</code> annotation and the <code>t5/core/ajax</code> JavaScript function, as explained in the "<span style="font-size: 14.0px;">Invoking server-side event handler methods from JavaScript" section below.</span></p><h3 id="AjaxandZones-Zones">Zones</h3><p>Zones are Tapestry's approach to performing partial page updates. A <a class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Zone.html">Zone component</a> 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 i t will have the attribute <code>data-container-type=zone</code>. The client-side support for Zones is keyed off of this attribute and value.</p><p>Starting in Tapestry 5.4 you can use any HTML element in your template as a zone marker, by passing its client-side id to the two-argument version of the addRender method.</p><p><span style="line-height: 1.4285715;">A Zone updated can be triggered by an EventLink, ActionLink or Select component, or by a Form. All of these components support the <code>async</code> and/or <code>zone</code> parameters. Clicking such a link will invoke an event handler method on the server as normal ... except that a </span><em style="line-height: 1.4285715;">partial page response</em><span style="line-height: 1.4285715;"> is sent to the client, and the content of that response is used to update the Zone's <div> in place.</span></p><div class="navmenu" style="float:right; background:#eee; margin:3px; padding:0 1em"> <p> <strong>JumpStart Demo:</strong><br clear="none"> <a class="external-link" href="http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/actionlink" rel="nofollow">AJAX ActionLink</a></p></div><h3 id="AjaxandZones-EventHandlerReturnTypes">Event Handler Return Types</h3><p>In a traditional request, the return value of an event handler method may used to determine which page will render a <em>complete</em> response, and a <em>redirect</em> may sent to the client to render the new page (as a new request).</p><p>In contrast, with a Zone update, the return value may used to render a <em>partial response</em> within the <em>same request</em>.</p><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Starting in Tapestry 5.3, Ajax event handlers typically have a void return type and use AjaxResponseRenderer to indicate which zone to update. The AjaxResponseRe nder approach means that the <code>zone</code> parameter's value (oridinarily indicating which zone to update) is no longer needed. Tapestry 5.4 introduced the <code>async="true"</code> parameter to avoid having to redundantly indicate which zone to update.</p></div></div><p>If you only have one zone to update and don't want to use AjaxResponseRenderer, you can instead return a value from your event handler method. The simplest case is just to return the zone's own body:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Inject Modified: websites/production/tapestry/content/cache/main.pageCache ============================================================================== Binary files - no diff available.