Author: buildbot
Date: Sat Mar 18 17:20:47 2017
New Revision: 1008590
Log:
Production update by buildbot for tapestry
Modified:
websites/production/tapestry/content/ajax-and-zones.html
websites/production/tapestry/content/cache/main.pageCache
websites/production/tapestry/content/page-navigation.html
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 Sat Mar 18
17:20:47 2017
@@ -78,7 +78,7 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><p>Tapestry provides easy-to-use
support for <strong>Ajax</strong>, the technique of using JavaScript to
dynamically update parts of a web page with content from the server without
redrawing the whole page. With Tapestry, you can do simple Ajax updates without
having to write any JavaScript code at all.</p><div class="aui-label"
style="float:right" title="Related Articles">
+ <div id="ConfluenceContent"><div class="aui-label"
style="float:right" title="Related Articles">
@@ -174,14 +174,14 @@
</div>
-<p>Ajax support is included in many <a
href="component-reference.html">built-in components</a> and <a
href="component-mixins.html">component mixins</a> via
the <code>async</code> parameter (in Tapestry 5.4+) and
the <code>zone</code> parameter (for earlier versions). Here we use an
EventLink component to trigger an Ajax update of another area of the
page:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Page or
component template (partial)</b></div><div class="codeContent panelContent pdl">
+<p>Tapestry provides easy-to-use support for <strong>Ajax</strong>, the
technique of using JavaScript to dynamically update parts of a web page with
content from the server without redrawing the whole page. With Tapestry, you
can do simple Ajax updates without having to write any JavaScript code at
all.</p><p>Ajax support is included in many <a
href="component-reference.html">built-in components</a> and <a
href="component-mixins.html">component mixins</a> via
the <code>async</code> parameter (in Tapestry 5.4+) and
the <code>zone</code> parameter (for earlier versions). Here we use an
EventLink component to trigger an Ajax update of another area of the
page:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Page or
component template (partial)</b></div><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><t:eventlink event="updateTime"
async="true">update</t:eventlink>
...
<t:zone t:id="timeArea" id="timeArea">
The current time is ${currentTime}
</t:zone>
</pre>
-</div></div><p>The corresponding Java code looks like this:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Page or component class
(partial)</b></div><div class="codeContent panelContent pdl">
+</div></div><p>The corresponding Java code might look like this:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Page or component class
(partial)</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Inject
private AjaxResponseRenderer ajaxResponseRenderer;
@@ -197,9 +197,9 @@ 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><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. Starting
in Tapestry 5.4 you can use any HTML element in your template as that marker,
using the two-argument version of the addRender method.</p><p>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 keyed off of this attribute and value.</p><p><span
style="line-height: 1.4285715;
">A Zone can be updated via 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><h3
id="AjaxandZones-EventHandlerReturnTypes">Event Handler Return
Types</h3><p></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><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 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 s
tyle="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>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>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 AjaxResponseRender approach means that
the <code>zone</code> parameter's value (oridinarily i
ndicating 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>This return value is often
just the zone's own body (as below), but it can also be an injected component
or block. The value will be rendered, and that markup will be used on the
client side to update the Zone's <div>.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+ <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
private Request request;
@@ -209,9 +209,8 @@ private Zone myZone;
Object onActionFromSomeLink()
{
return myZone.getBody(); // AJAX request, return zone's own body
-}
-</pre>
-</div></div><p>The possible return values are:</p><ul><li>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.</li><li>The zone's own body</li><li>A <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/json/JSONObject.html">JSONObject</a>
or <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/json/JSONArray.html">JSONArray</a>,
which will be sent as the response.</li><li>A <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/StreamResponse.html">StreamResponse</a>,
which will be sent as the response.</li><li>A <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Link.html">Link</a>,
which will send a redirect to the client.</li><li>A page name (as a String),
or a page class,
or a page instance, which will send a redirect to the indicated
page.</li></ul><h3 id="AjaxandZones-GracefulDegradation">Graceful
Degradation</h3><p>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 <em>traditional</em> request.</p><p>To support graceful
degradation, you should detect that case in your event handler method and
return a traditional response: a page, page name or page class. This is
accomplished by injecting the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/Request.html">Request</a>
object, and invoking the isXHR() method. This value will be true for Ajax
requests, and false for traditional request.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+}</pre>
+</div></div><p>The possible return values are:</p><ul><li>An injected 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.</li><li>The zone's own body (using Zone's getBody()
method)</li><li>null (to redraw the current page)</li><li>A <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/json/JSONObject.html">JSONObject</a>
or <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/json/JSONArray.html">JSONArray</a>,
which will be sent as the response.</li><li>A <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/StreamResponse.html">StreamResponse</a>,
which will be sent as the response.</li><li>A <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Link.html">Link</a>,
which wil
l send a redirect to the client.</li><li>A page name (as a String), or a page
class, or a page instance, which will send a redirect to the indicated
page.</li></ul><p>See <a href="page-navigation.html">Page Navigation</a> for
full descriptions of the above.</p><h3
id="AjaxandZones-GracefulDegradation">Graceful Degradation</h3><p>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 <em>traditional</em>
request.</p><p>This happens automatically when your event handler method has a
void return type.</p><p>However, to support graceful degradation when your
event handler method has a <em>non-void</em> return type, you should detect
non-Ajax requests and return a traditional response, typically null to redraw
the whole page. This is accomplished by injecting the <a class="external-link"
href="http://tapestry.apache.org
/current/apidocs/org/apache/tapestry5/services/Request.html">Request</a>
object, and invoking the isXHR() method. This value will be true for Ajax
requests, and false for traditional request.</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
private Request request;
@@ -226,7 +225,7 @@ Object onActionFromSomeLink()
</pre>
</div></div><h3 id="AjaxandZones-MultipleZoneUpdates">Multiple Zone
Updates</h3><p></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/multiplezoneupdate"
rel="nofollow">AJAX Multiple Zone Update</a></p></div>An event handler often
needs to update multiple zones on the client side. To accomplish this, use an
<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ajax/AjaxResponseRenderer.html">AjaxResponseRenderer</a>,
indicating the zones to update. You must know the client-side id for each zone
to update (the best way for this is to lock down the zone's id using the id
parameter of the Zone component).<p><em>AjaxResponseRenderer was introduced in
Tapestry 5.3. For Tapestry 5.2 and earlier, return a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ajax/MultiZoneUpdate.html">MultiZoneUpdate</a>
object instead.</em></p><p>The renderer for each zone can be the zone itself,
a block, a component, a <a class="external-link" hr
ef="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Renderable.html">Renderable</a>
or a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/runtime/RenderCommand.html">RenderCommand</a>
... or an object, such as String, that can be coerced to either of
these.</p><div class="sectionColumnWrapper"><div class="sectionMacro"><div
class="sectionMacroRow"><div class="columnMacro"><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>For Tapestry 5.3 and later</b></div><div
class="codeContent panelContent pdl">
+ <a class="external-link"
href="http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/multiplezoneupdate"
rel="nofollow">AJAX Multiple Zone Update</a></p></div>An event handler often
needs to update multiple zones on the client side. To accomplish this, use an
<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ajax/AjaxResponseRenderer.html">AjaxResponseRenderer</a>,
indicating the zones to update. You must know the client-side id for each zone
to update (the best way for this is to lock down the zone's id using the id
parameter of the Zone component).<p><em>AjaxResponseRenderer was introduced in
Tapestry 5.3. For Tapestry 5.2 and earlier, return a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ajax/MultiZoneUpdate.html">MultiZoneUpdate</a>
object instead.</em></p><p>The renderer for each zone can be the zone itself,
a block, a component, a <a class="external-link" hr
ef="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Renderable.html">Renderable</a>
or a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/runtime/RenderCommand.html">RenderCommand</a>
... or an object, such as String, that can be coerced to either of
these.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>For
Tapestry 5.3 and later</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@InjectComponent
private Zone userInput;
@@ -242,42 +241,26 @@ void onActionFromRegister()
userInput).addRender("helpPanel", helpPanel);
}
</pre>
-</div></div></div><div class="columnMacro"><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>For Tapestry 5.1, 5.2 and
5.3</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Inject
-private Form registrationForm;
-
-@Inject Block registrationHelp;
-
-Object onActionFromRegister()
-{
- return new MultiZoneUpdate("userInput",
- registrationForm).add("helpPanel",
- registrationHelp);
-}
-</pre>
-</div></div><p>    <em>Note that MultiZoneUpdate is deprecated
starting with Tapestry 5.3.</em></p></div></div></div></div><p><span
style="line-height: 1.4285715;">These examples assume that there are two zones,
"userInput" and "helpPanel", somewhere in the rendered page, waiting to receive
the updated content.</span></p><p><span style="line-height:
1.4285715;"> </span></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>In this example, the Zone receives
the update but does not provide any content. That's OK, the other client-side
elements (<code>userInput</code> and <code>helpPanel</code>) will be updated,
and the zone's content left unchanged.</p></div></div><p>This demonstrates why
it is necessary for the developer to specify a particular client-side id for
Zone components; if they were dyn
amically allocated ids, as is typical in most other elements, it would be
impossible for this code to know what client-side id was used for the
Zone.</p><h3 id="AjaxandZones-ZoneComponentIdvs.ZoneElementId">Zone Component
Id vs. Zone Element Id</h3><p>Like all Tapestry components, Zones have a
component id, specified using the <code>t:id</code> attribute. If you do not
assign a component id, a unique id is assigned by Tapestry.</p><p>However, to
coordinate things on the client side, it is necessary for components that wish
to update the zone know the <em>client-side element id</em>. This is specified
with the <code>id</code> parameter of the Zone component. If the
<code>id</code> parameter is not bound, then a unique value (for the current
page and render) is generated by Tapestry and this value is difficult to
predict. The actual value will be available as the <code>clientId</code>
property of the Zone component itself.</p><p>Remember that the component id
(<code>t:id</code>) is us
ed to <em>inject</em> the Zone component into the containing page or
component. The<br clear="none"> client-side id (<code>id</code>) is used ... on
the client side to orchestrate requests and updates. You will often seen the
following construct:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p><span style="line-height: 1.4285715;">This example assumes that
there are two zones, "userInput" and "helpPanel", somewhere in the rendered
page, waiting to receive the updated content.</span></p><p><span
style="line-height: 1.4285715;"> </span></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>In this example, the Zone receives
the update but does not provide any content. That's OK, the other client-side
elements (<code>userInput</code> and <code>helpPanel</code>) will be updated,
and the zone's content left unchanged.</p></div></div><p>This demonstrates why
it is necessary for the developer to specify a particular client-side id for
Zone components; if they were dynamically allocated ids, as is typical in most
other elements, it would be impossible for this code to know what client-sid
e id was used for the Zone.</p><h3
id="AjaxandZones-ZoneComponentIdvs.ZoneElementId">Zone Component Id vs. Zone
Element Id</h3><p>Like all Tapestry components, Zones have a component id,
specified using the <code>t:id</code> attribute. If you do not assign a
component id, a unique id is assigned by Tapestry.</p><p>However, to coordinate
things on the client side, it is necessary for components that wish to update
the zone know the <em>client-side element id</em>. This is specified with the
<code>id</code> parameter of the Zone component. If the <code>id</code>
parameter is not bound, then a unique value (for the current page and render)
is generated by Tapestry and this value is difficult to predict. (The actual
value will be available as the <code>clientId</code> property of the Zone
component itself.)</p><p>Remember that the component id (<code>t:id</code>) is
used to <em>inject</em> the Zone component into the containing page or
component. The client-side id (<code>id</code>) is
used on the client side to orchestrate requests and updates. You will often
seen the following construct:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><t:zone t:id="myZone" id="myzone"> ...
</t:zone>
-
-<t:actionlink t:id="update" zone="myzone">update</t:actionlink>
</pre>
-</div></div>
+</div></div><h3 id="AjaxandZones-TheContainingZone(zone="^")">The
Containing Zone (zone="^")</h3>
<div class="confluence-information-macro
confluence-information-macro-information"><p class="title">Added in
5.2</p><span class="aui-icon aui-icon-small aui-iconfont-info
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">
</div></div>
<div class="error"><span class="error">Unknown macro: {div}</span>
-<p>If the Form or Link is enclosed by the Zone itself, then the
<code>zone</code> parameter may be set to the special value <code>^</code>. The
carat is evaluated, on the client side, by searching up form the form or link
element for the first enclosing element that is a Zone. In this way, the
client-side coordination can occur without having to know what the specific
client-side id of the Zone is. Because of this, in some cases, it is no longer
necessary to specify the Zone's <code>id</code> parameter.</p>
-</div><h3 id="AjaxandZones-AnUpdatedivwithinaZonediv">An Update div within a
Zone div</h3>
+<p> </p></div><p>If the Form or Link is enclosed by the Zone itself, and
you're using the <code>zone</code> parameter instead of
the <code>async</code> parameter, then the <code>zone</code>
parameter may be set to the special
value <strong><code>^</code></strong><code> (the carat)</code>. The zone
is found – on the client side – by searching up form the
form or link element for the first enclosing element that is a Zone. In this
way, the client-side coordination can occur without having to know what the
specific client-side id of the Zone is. Because of this, in some cases it is no
longer necessary to specify the Zone's <code>id</code> parameter.</p><h3
id="AjaxandZones-AnUpdatedivwithinaZonediv(Tapestry5.3andearlier)">An Update
div within a Zone div (Tapestry 5.3 and earlier)</h3>
<div class="error"><span class="error">Unknown macro: {div}</span>
-<p><em>This feature is removed starting with Tapestry 5.4</em></p></div><p>In
many situations, a Zone is a kind of "wrapper" or "container" for dynamic
content; one that provides a look and feel ... a bit of wrapping markup to
create a border. In that situation, the Zone <div> may contain an update
<div>.</p><p>An Update <div> is specifically a <div> element
marked with the CSS class "t-zone-update", <em>inside</em> the Zone's
<div>.</p><p>If an Update div exists within a Zone div, then when
Tapestry updates a zone only the update <div>'s content will be changed,
rather than the entire Zone <div>.</p><p>The show and update functions
(see Zone Functions, below) apply to the Zone <div>, not just the update
<div>.</p><h3
id="AjaxandZones-ZoneEffectFunctions(Tapestry5.3andearlier)">Zone Effect
Functions (Tapestry 5.3 and earlier)</h3><p> </p>
+<p>This feature is removed starting with Tapestry 5.4</p></div><p>In many
situations, a Zone is a kind of "wrapper" or "container" for dynamic content;
one that provides a look and feel ... a bit of wrapping markup to create a
border. In that situation, the Zone <div> may contain an update
<div>.</p><p>An Update <div> is specifically a <div> element
marked with the CSS class "t-zone-update", <em>inside</em> the Zone's
<div>.</p><p>If an Update div exists within a Zone div, then when
Tapestry updates a zone only the update <div>'s content will be changed,
rather than the entire Zone <div>.</p><p>The show and update functions
(see Zone Functions, below) apply to the Zone <div>, not just the update
<div>.</p><h3
id="AjaxandZones-ZoneEffectFunctions(Tapestry5.3andearlier)">Zone Effect
Functions (Tapestry 5.3 and earlier)</h3><p> </p>
<div class="error"><span class="error">Unknown macro: {div}</span>
-<p>_This feature refers to client-side logic only present in Tapestry 5.3 or
earlier. For 5.4, there are client-side events that are triggered before and
after changes to the Zone; listeners on those events can trigger whatever
animations they like.</p></div><p> </p><p>A Zone may be initially visible
or invisible. When a Zone is updated, it is made visible if not currently so.
This is accomplished via a function on the Tapestry.ElementEffect client-side
object. By default, the show() function is used for this purpose. If you want
Tapestry to call a different Tapestry.ElementEffect function when updates
occur, specify its name with the zone's show parameter.</p><p>If a Zone is
already visible, then a different effect function is used to highlight the
change. By default, the highlight() function is called, which performs a yellow
fade to highlight that the content of the Zone has changed. Alternatively, you
can specify a different effect function with the Zone's update parameter:
</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Tapestry.ElementEffect
Function</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Result</p></th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>highlight()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>(the default) highlight changes to an already-visible
zone</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>show()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>make the zone visible if it isn't already
visible</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>slidedown()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>scroll the content down</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>slideup()</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>slide the content back up
(opposite of slidedown)</p></td></tr><tr><td colspan="1" row
span="1" class="confluenceTd"><p>fade()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>fade the content out (opposite of
show)</p></td></tr></tbody></table></div><p>To have Tapestry update a zone
without the usual yellow highlight effect, just specify "show" for the update
parameter:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<p>This feature refers to client-side logic only present in Tapestry 5.3 or
earlier. For 5.4, there are client-side events that are triggered before and
after changes to the Zone; listeners on those events can trigger whatever
animations they like.</p></div><p>A Zone may be initially visible or invisible.
When a Zone is updated, it is made visible if not currently so. This is
accomplished via a function on the Tapestry.ElementEffect client-side object.
By default, the show() function is used for this purpose. If you want Tapestry
to call a different Tapestry.ElementEffect function when updates occur, specify
its name with the zone's show parameter.</p><p>If a Zone is already visible,
then a different effect function is used to highlight the change. By default,
the highlight() function is called, which performs a yellow fade to highlight
that the content of the Zone has changed. Alternatively, you can specify a
different effect function with the Zone's update parameter:</p><div class
="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Tapestry.ElementEffect Function</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p>Result</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>highlight()</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>(the default) highlight changes
to an already-visible zone</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>show()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>make the zone visible if it isn't already
visible</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>slidedown()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>scroll the content down</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>slideup()</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>slide the content back up
(opposite of slidedown)</p></td></tr><tr><td colspan="1" rowspan="1" class
="confluenceTd"><p>fade()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>fade the content out (opposite of
show)</p></td></tr></tbody></table></div><p>To have Tapestry update a zone
without the usual yellow highlight effect, just specify "show" for the update
parameter:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><t:zone t:id="myZone" t:update="show"></pre>
</div></div><p>You may also define and use your own JavaScript effect function
(with lower-case names), like this:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: js; gutter: false; theme: Default"
style="font-size:12px;">Tapestry.ElementEffect.myeffectname =
function(element){ YourJavascriptCodeGoesHere; };
</pre>
-</div></div><h3 id="AjaxandZones-ZoneLimitations">Zone
Limitations</h3><p>Unlike many other situations, Tapestry relies on you to
specify useful and unique ids to Zone components, then reference those ids
inside EventLink (or ActionLink, or Form) components. Using Zone components
inside any kind of loop may cause additional problems, as Tapestry will
<em>uniqueify</em> the client id you specify (appending an index
number).</p><p>The show and update function names are converted to lower case;
all the methods of Tapestry.ElementEffect should have all lower-case names.
Because client-side JavaScript is so fluid (new methods may be added to
existing objects), Tapestry makes no attempt to validate the function names ...
however, if the names are not valid, then the default show and highlight
methods will be used.</p><p>Zones may only be used inside the <em>body</em> of
a page, not the head<em>.</em></p><h3 id="AjaxandZones-MoreInformation">More
Information</h3><p>For examples of extendin
g a Form with a Zone and updating multiple zones at once, see the <a
href="ajax-components-faq.html">Ajax Components FAQ</a>.</p><p><span
class="confluence-anchor-link" id="AjaxandZones-autocomplete"></span></p><h2
id="AjaxandZones-AutocompleteMixin">Autocomplete Mixin</h2><p></p><div
class="navmenu" style="float:right; background:#eee; margin:3px; padding:0 1em">
+</div></div><h3 id="AjaxandZones-ZoneLimitations">Zone
Limitations</h3><p>Unlike many other situations, Tapestry relies on you to
specify useful and unique ids to Zone components, then reference those ids
inside EventLink (or ActionLink, or Form) components. Using Zone components
inside any kind of loop may cause additional problems, as Tapestry will
<em>uniqueify</em> the client id you specify (appending an index
number).</p><p>The show and update function names (Tapestry 5.3 and earlier
only) are converted to lower case; all the methods of Tapestry.ElementEffect
should have all lower-case names. Because client-side JavaScript is so fluid
(new methods may be added to existing objects), Tapestry makes no attempt to
validate the function names ... however, if the names are not valid, then the
default show and highlight methods will be used.</p><p>Zones may only be used
inside the <em>body</em> of a page, not the head<em>.</em></p><h3
id="AjaxandZones-MoreInformation">More Information
</h3><p>For examples of extending a Form with a Zone and updating multiple
zones at once, see the <a href="ajax-components-faq.html">Ajax Components
FAQ</a>.</p><p>There are also a number of Ajax-related examples at
the  <a class="external-link"
href="http://jumpstart.doublenegative.com.au/jumpstart7/" rel="nofollow"><span
class="confluence-link">Tapestry JumpStart</span></a> site.</p><p><span
class="confluence-anchor-link" id="AjaxandZones-autocomplete"></span></p><h2
id="AjaxandZones-AutocompleteMixin">Autocomplete Mixin</h2><p></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/autocompletemixin"
rel="nofollow">Autocomplete Mixin</a></p></div>The <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/Autocomplete.html">Autocomplete</a>
mixin exists to allow a text field to query the server for completions for a
partially entered phrase. It is often used in situations where the field exists
to select a single value from a large set, too large to successfully download
to the client as a drop down list; for example, when the number of values to
select from is numbered in the thousands.<p>Autocomplete can be added to an
existing text field:</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;"> <t:textfield t:id="accountName"
t:mixins="autocomplete" size="100"/>
Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/tapestry/content/page-navigation.html
==============================================================================
--- websites/production/tapestry/content/page-navigation.html (original)
+++ websites/production/tapestry/content/page-navigation.html Sat Mar 18
17:20:47 2017
@@ -46,13 +46,26 @@
<div class="wrapper bs">
- <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div></div>
+ <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div>
+
+</div>
<div id="top">
- <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span><form
enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
- <input type="text" name="q">
- <input type="submit" value="Search">
-</form></div><div class="emblem" style="float:left"><p><a
href="index.html"><span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div><div
class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Page Navigation</h1></div></div>
+ <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span>
+<form enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
+ <input type="text" name="q">
+ <input type="submit" value="Search">
+</form>
+
+</div>
+
+
+<div class="emblem" style="float:left"><p><a href="index.html"><span
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image
confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div>
+
+
+<div class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Page Navigation</h1></div>
+
+</div>
<div class="clearer"></div>
</div>
@@ -64,49 +77,85 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><div class="aui-label"
style="float:right" title="Related Articles"><h3>Related Articles</h3><ul
class="content-by-label"><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="content-type-and-markup.html">Content Type and Markup</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="page-navigation.html">Page Navigation</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="page-life-cycle.html">Page Life Cycle</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="component-rendering.html">Component Rendering</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="component-events.html">Component Events</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="component-events-faq.html">Component Events FAQ</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="request-processing.html">Request Processing</a>
- </div> </li></ul></div><p>In essence, a Tapestry application is a number of
related pages, working together. To some degree, each page is like an
application unto itself.</p><p>Any individual request will be targeted at a
single page. Requests come in two forms: </p><ul><li><em>component
event</em> requests target a specific component on a specific page, triggering
an event within that component</li><li><em>render</em> requests target a
specific page, and stream the HTML markup for that page back to the
client</li></ul><p>This dichotomy between component event requests and render
requests alleviates a number of problems in traditional web applications
related to the browser back button, or to the user hitting the refresh button
in their browser.</p><p><br clear="none"><span style="color:
rgb(83,145,38);font-size: 20.0px;line-height: 1.5;">Logical Page Name
Shortening</span></p><p>In certain cases, Tapestry will shorten the the logical
name of a page. For example, the page cla
ss org.example.pages.address.CreateAddress will be given a logical name of
"address/Create" (the redundant "Address" is removed as a suffix). However,
this only affects how the page is referenced in URLs; the template file will
still be CreateAddress.tml, whether on the classpath, or as
address/CreateAddress.tml (in the web context).</p><p><span>Tapestry actually
creates multiple names for the name page: "address/Create" and
"address/CreateAddress" are both synonymous. You can user either in Java code
that refers to a page by name, or as the page parameter of a
PageLink.</span></p><h2
id="PageNavigation-ComponentEventRequests&Responses">Component Event
Requests & Responses</h2><p>Main Article: <a
href="component-events.html">Component Events</a></p><p>Component event
requests may take the form of hyperlinks (<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/EventLink.html">EventLink</a>
or <a class="external-
link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/ActionLink.html">ActionLink</a>)
or form submissions (<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html">Form</a>).</p><p>The
value returned from an <a href="component-events.html">event handler
method</a> controls the response sent to the client web browser.</p><p>The URL
for a component event request identifies the name of the page, the nested id of
the component, and the name of the event to trigger on the component (this is
usually "action"). Further, a component event request may contain additional
context information, which will be provided to the event handler
method.</p><p>These URLs expose a bit of the internal structure of the
application. Over time, as an application grows and is maintained, the ids of
components may change. This means that component event request URLs should not
be bookmarked. Fortunate
ly, users will rarely have the chance to do so (see below).</p><h3
id="PageNavigation-1.Nullresponse">1. Null response</h3><p>If the event handler
method returns no value, or returns null, then the current page (the page
containing the component) will render the response.</p><p>A page render URL for
the current page is created and sent to the client as a client side redirect.
The client browser will automatically submit a new request to generate the
page.</p><p>The user will see the newly generated content in their browser. In
addition, the URL in the browser's address bar will be a render request URL.
Render request URLs are shorter and contain less application structure (for
instance, they don't include component ids or event types). Render requests
URLs are what your users will bookmark. The component event request URLs are
transitory, meaningful only while the application is actively engaged, and not
meant to be used in later sessions.</p><div class="code panel pdl" style="borde
r-width: 1px;"><div class="codeContent panelContent pdl">
+ <div id="ConfluenceContent"><div class="aui-label"
style="float:right" title="Related Articles">
+
+
+
+
+
+
+
+
+<h3>Related Articles</h3>
+
+<ul class="content-by-label"><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="content-type-and-markup.html">Content Type
and Markup</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="page-navigation.html">Page Navigation</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="page-life-cycle.html">Page Life Cycle</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="component-rendering.html">Component
Rendering</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="component-events.html">Component Events</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="component-events-faq.html">Component Events
FAQ</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="request-processing.html">Request
Processing</a>
+
+
+ </div>
+ </li></ul>
+</div>
+
+
+<p>In essence, a Tapestry application is a number of related pages, working
together. To some degree, each page is like an application unto
itself.</p><p>Any individual request will be targeted at a single page.
Requests come in two forms: </p><ul><li><em>component event</em> requests
target a specific component on a specific page, triggering an event within that
component</li><li><em>render</em> requests target a specific page, and stream
the HTML markup for that page back to the client</li></ul><p>This dichotomy
between component event requests and render requests alleviates a number of
problems in traditional web applications related to the browser back button, or
to the user hitting the refresh button in their browser.</p><p><br
clear="none"><span style="color: rgb(83,145,38);font-size: 20.0px;line-height:
1.5;">Logical Page Name Shortening</span></p><p>In certain cases, Tapestry will
shorten the the logical name of a page. For example, the page class
org.example.pages.addr
ess.CreateAddress will be given a logical name of "address/Create" (the
redundant "Address" is removed as a suffix). However, this only affects how the
page is referenced in URLs; the template file will still be CreateAddress.tml,
whether on the classpath, or as address/CreateAddress.tml (in the web
context).</p><p><span>Tapestry actually creates multiple names for the name
page: "address/Create" and "address/CreateAddress" are both synonymous. You can
user either in Java code that refers to a page by name, or as the page
parameter of a PageLink.</span></p><h2
id="PageNavigation-ComponentEventRequests&Responses">Component Event
Requests & Responses</h2><p>Main Article: <a
href="component-events.html">Component Events</a></p><p>Component event
requests may take the form of hyperlinks (<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/EventLink.html">EventLink</a>
or <a class="external-link" href="http://tapest
ry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/ActionLink.html">ActionLink</a>)
or form submissions (<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html">Form</a>).</p><p>The
value returned from an <a href="component-events.html">event handler
method</a> controls the response sent to the client web browser.</p><p>The URL
for a component event request identifies the name of the page, the nested id of
the component, and the name of the event to trigger on the component (specified
by the "event" parameter of EventLink, or "action" for an ActionLink). Further,
a component event request may contain additional context information, which
will be provided to the event handler method.</p><p>These URLs expose a bit of
the internal structure of the application. Over time, as an application grows
and is maintained, the ids of components may change. This means that component
event request URLs should
not be bookmarked. Fortunately, users will rarely have the chance to do so
(see below).</p><h3 id="PageNavigation-1.Nullresponse">1. Null
response</h3><p>If the event handler method returns no value, or returns null,
then the current page (the page containing the component) will render the
response.</p><p>A page render URL for the current page is created and sent to
the client as a client side redirect. The client browser will automatically
submit a new request to generate the page.</p><p>The user will see the newly
generated content in their browser. In addition, the URL in the browser's
address bar will be a render request URL. Render request URLs are shorter and
contain less application structure (for instance, they don't include component
ids or event types). Render requests URLs are what your users will bookmark.
The component event request URLs are transitory, meaningful only while the
application is actively engaged, and not meant to be used in later
sessions.</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;">public Object onAction(){
return null;
}</pre>
@@ -129,7 +178,24 @@ public Object onAction(){
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public Object onAction(){
return new HttpError(302, "The Error message);
}</pre>
-</div></div><h3 id="PageNavigation-6.Linkresponse">6. Link response</h3><p>An
event handler method may return a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Link.html">Link</a>
instance directly. The Link is converted into a URL and a client redirect to
that URL is sent to the client.</p><p>The <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ComponentResources.html">ComponentResources</a>
object that is injected into your pages (and components) has methods for
creating component links.</p><p>The <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html">PageRenderLinkSource</a>
service can be injected to allow links to other pages to be created (though
that is rarely necessary, given the other options listed above).</p><h3
id="PageNavigation-7.Streamresponse">7. Stream response</h3><p>An event handler
can als
o return a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/StreamResponse.html">StreamResponse</a>
object, which encapsulates a stream to be sent directly to the client browser.
This is useful for components that want to, say, generate an image or PDF and
provide it to the client.</p><h3 id="PageNavigation-8.URLresponse">8. URL
response</h3><p>A java.net.URL response is handled as a client redirect to an
external URL. (In Tapestry 5.3.x and earlier this only works for non-Ajax
requests.)</p><h3 id="PageNavigation-9.Objectresponse">9. Object
response</h3><p>Any other type of object returned from an event handler method
is an error.</p><h2 id="PageNavigation-PageRenderRequests">Page Render
Requests</h2><p>Render requests are simpler in structure and behavior than
component event requests. In the simplest case, the URL is simply the logical
name of the page.</p><p>Pages may have an <em>activation context</em>. The
activation context repre
sents persistent information about the state of the page. In practical terms,
the activation context is usually the id of some database-persistent
object.</p><p>When a page has an activation context, the values of the context
are appended to the URL path. For example,
in <code>http://www.example.com/myapp/foo/bar</code> the "myapp" part is
the servlet context (usually the name of your app), and the "foo/bar" part is
the activation context, with "foo" being the first activation parameter and
"bar" being the second.</p><p>It is common for most pages to not have any
activation context.</p><p>The activation context may be explicitly set when the
render request link is created (the PageLink component has a context parameter
for this purpose).</p><p>When no explicit activation context is provided, the
page itself is queried for its activation context. This querying takes the form
of an event trigger. The event name is "passivate" (as we'll see shortly,
there's a corresponding "activa
te"). The return value of the method is used as the context. For
example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><h3 id="PageNavigation-6.Linkresponse">6. Link response</h3><p>An
event handler method may return a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Link.html">Link</a>
instance directly. The Link is converted into a URL and a client redirect to
that URL is sent to the client.</p><p>The <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ComponentResources.html">ComponentResources</a>
object that is injected into your pages (and components) has methods for
creating component links.</p><p>The <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html">PageRenderLinkSource</a>
service can be injected to allow links to other pages to be created (though
that is rarely necessary, given the other options listed above).</p><h3
id="PageNavigation-7.Streamresponse">7. Stream response</h3><p>An event handler
can als
o return a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/StreamResponse.html">StreamResponse</a>
object, which encapsulates a stream to be sent directly to the client browser.
This is useful for components that want to, say, generate an image or PDF and
provide it to the client:</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;">public Object onAction(){
+ return new StreamResponse() {
+ @Override
+ public String getContentType() {
+ return "application/pdf";
+ }
+ @Override
+ public InputStream getStream() throws IOException {
+ return new ByteArrayInputStream(getMyPdfByteArray());
+ }
+ @Override
+ public void prepareResponse(Response response) {
+ response.setHeader("Content-Disposition", "attachment;
filename=\"" + myFileName + "\"");
+ }
+ };
+}</pre>
+</div></div><p> </p><h3 id="PageNavigation-8.URLresponse">8. URL
response</h3><p>A java.net.URL response is handled as a client redirect to an
external URL. (In Tapestry 5.3.x and earlier this only works for non-Ajax
requests.)</p><h3 id="PageNavigation-9.Objectresponse">9. Object
response</h3><p>Any other type of object returned from an event handler method
is an error.</p><h2 id="PageNavigation-PageRenderRequests">Page Render
Requests</h2><p>Render requests are simpler in structure and behavior than
component event requests. In the simplest case, the URL is simply the logical
name of the page.</p><p>Pages may have an <em>activation context</em>. The
activation context represents persistent information about the state of the
page. In practical terms, the activation context is usually the id of some
database-persistent object.</p><p>When a page has an activation context, the
values of the context are appended to the URL path. For example,
in <code>http://www.example.com/my
app/foo/bar</code> the "myapp" part is the servlet context (usually the name
of your app), and the "foo/bar" part is the activation context, with "foo"
being the first activation parameter and "bar" being the second.</p><p>It is
common for most pages to not have any activation context.</p><p>The activation
context may be explicitly set when the render request link is created (the
PageLink component has a context parameter for this purpose).</p><p>When no
explicit activation context is provided, the page itself is queried for its
activation context. This querying takes the form of an event trigger. The event
name is "passivate" (as we'll see shortly, there's a corresponding "activate").
The return value of the method is used as the context. For example:</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;">public class ProductDetail
{
private Product product;