You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by bu...@apache.org on 2014/02/15 22:20:42 UTC

svn commit: r898066 - in /websites/production/tapestry/content: cache/main.pageCache page-navigation.html

Author: buildbot
Date: Sat Feb 15 21:20:42 2014
New Revision: 898066

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/cache/main.pageCache
    websites/production/tapestry/content/page-navigation.html

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 Feb 15 21:20:42 2014
@@ -25,10 +25,10 @@
   </title>
   <link type="text/css" rel="stylesheet" href="/resources/space.css">
 
-    <link href='http://cxf.apache.org/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css' />
-  <link href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
-  <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
-  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+    <link href='/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css' />
+  <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
+  <script src='/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
+  <script src='/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -69,9 +69,7 @@
   </div>
 
 <div id="content">
-<div id="ConfluenceContent"><h1 id="PageNavigation-PageNavigation">Page Navigation</h1>
-
-<div class="navmenu" style="float:right; background:#eee; margin:3px; padding:3px">
+<div id="ConfluenceContent"><h1 id="PageNavigation-PageNavigation">Page Navigation</h1><div class="navmenu" style="float:right; background:#eee; margin:3px; padding:3px">
 <h3>Related Articles</h3>
 <ul class="content-by-label"><li>
             <div>
@@ -114,7 +112,7 @@
                     <span class="icon icon-page" title="Page">Page:</span>            </div>
 
             <div class="details">
-                            <a shape="rect" href="page-navigation.html">Page Navigation</a>
+                            <a shape="rect" href="component-rendering.html">Component Rendering</a>
                     
                 
                             </div>
@@ -132,149 +130,42 @@
                     <span class="icon icon-page" title="Page">Page:</span>            </div>
 
             <div class="details">
-                            <a shape="rect" href="component-rendering.html">Component Rendering</a>
+                            <a shape="rect" href="page-navigation.html">Page Navigation</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>{float:right<br clear="none">
-This dichotomy between component event requests and render requests is new in Tapestry 5. It is in some ways based on ideas from the Portlet specification and differentiating the two types of 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>
-
-<h2 id="PageNavigation-LogicalPageNameShortening">Logical Page Name Shortening</h2>
-
-<p>In certain cases, Tapestry will shorten the the logical name of a page. For example, the page class 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>
-
-    <div class="aui-message hint shadowed information-macro">
+</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:&#160;</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>{float:right<br clear="none"> This dichotomy between component event requests and render requests is new in Tapestry 5. It is in some ways based on ideas from the Portlet specification and differentiating the two types of 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><h2 id="PageNavigation-LogicalPageNameShortening">Logical Page Name Shortening</h2><p>I
 n certain cases, Tapestry will shorten the the logical name of a page. For example, the page class 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>    <div class="aui-message hint shadowed information-macro">
                             <span class="aui-icon icon-hint">Icon</span>
                 <div class="message-content">
-                            
-<p>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.</p>
+                            <p>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.</p>
                     </div>
     </div>
-
-
-<h2 id="PageNavigation-ComponentEventRequests&amp;Responses">Component Event Requests &amp; Responses</h2>
-
-<p>Main Article: <a shape="rect" href="component-events.html">Component Events</a></p>
-
-<p>Component event requests may take the form of hyperlinks (<a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/EventLink.html">EventLink</a> or <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/ActionLink.html">ActionLink</a>) or form submissions (<a shape="rect" 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 shape="rect" 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. 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 link 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">
+<h2 id="PageNavigation-ComponentEventRequests&amp;Responses">Component Event Requests &amp; Responses</h2><p>Main Article: <a shape="rect" href="component-events.html">Component Events</a></p><p>Component event requests may take the form of hyperlinks (<a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/EventLink.html">EventLink</a> or <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/ActionLink.html">ActionLink</a>) or form submissions (<a shape="rect" 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 shape="rect" 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. 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 link 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 browse
 r. 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">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public Object onAction(){
   return null;
 }]]></script>
-</div></div>
-
-<h3 id="PageNavigation-2.Stringresponse">2. String response</h3>
-
-<p>When a string is returned, it is expected to be the logical name of a page (as opposed to the page's fully qualified class name). As elsewhere, the name of the page is case insensitive.</p>
-
-<p>Again, a render request URL will be constructed and sent to the client as a redirect.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="PageNavigation-2.Stringresponse">2. String response</h3><p>When a string is returned, it is expected to be the logical name of a page (as opposed to the page's fully qualified class name). As elsewhere, the name of the page is case insensitive.</p><p>Again, a render request URL will be constructed and sent to the client as a redirect.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public String onAction(){
   return &quot;Index&quot;;
 }]]></script>
-</div></div>
-
-<h3 id="PageNavigation-3.Classresponse">3. Class response</h3>
-
-<p>When a class is returned, it is expected to be a page class. Returning a page class from an event handler is safer for refactoring than returning a page name.</p>
-
-<p>As with other response types, a render request URL will be constructed and sent to the client as a redirect.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="PageNavigation-3.Classresponse">3. Class response</h3><p>When a class is returned, it is expected to be a page class. Returning a page class from an event handler is safer for refactoring than returning a page name.</p><p>As with other response types, a render request URL will be constructed and sent to the client as a redirect.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public Object onAction(){
   return Index.class
 }]]></script>
-</div></div>
-
-<h3 id="PageNavigation-4.Pageresponse">4. Page response</h3>
-
-<p>You may also return an instance of a page, rather than the name or class of a page.</p>
-
-<p>A page may be injected via the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/InjectPage.html">InjectPage</a> annotation.</p>
-
-<p>Often, you will configure the page in some way before returning the page (examples below).</p>
-
-<p>You can also return a component within the page, but this will generate a runtime warning (unless you are doing a partial-page update via <a shape="rect" href="ajax-and-zones.html">Ajax</a>).</p>
-
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="PageNavigation-4.Pageresponse">4. Page response</h3><p>You may also return an instance of a page, rather than the name or class of a page.</p><p>A page may be injected via the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/InjectPage.html">InjectPage</a> annotation.</p><p>Often, you will configure the page in some way before returning the page (examples below).</p><p>You can also return a component within the page, but this will generate a runtime warning (unless you are doing a partial-page update via <a shape="rect" href="ajax-and-zones.html">Ajax</a>).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@InjectPage
 private Index index;
 
 public Object onAction(){
   return index;
 }]]></script>
-</div></div>
-
-<h3 id="PageNavigation-5.HttpError">5. HttpError</h3>
-
-<p>An event handler method may return a <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/HttpError.html">HttpError</a> instance to send an error response to the client.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-public Object onAction(){
+</div></div><h3 id="PageNavigation-5.HttpError">5. HttpError</h3><p>An event handler method may return a <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/HttpError.html">HttpError</a> instance to send an error response to the client.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public Object onAction(){
   return new HttpError(302, &quot;The Error message);
 }]]></script>
-</div></div>
-
-<h3 id="PageNavigation-6.Linkresponse">6. Link response</h3>
-
-<p>An event handler method may return a <a shape="rect" 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 shape="rect" 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 event and page render links.</p>
-
-<h3 id="PageNavigation-7.Streamresponse">7. Stream response</h3>
-
-<p>An event handler can also return a <a shape="rect" 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 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.</p>
-
-<p>Not all pages have an 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). When no explicit activation context is provided, the page itself is queried for its activation context.</p>
-
-<p>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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-public class ProductDetail
+</div></div><h3 id="PageNavigation-6.Linkresponse">6. Link response</h3><p>An event handler method may return a <a shape="rect" 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 shape="rect" 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 event and page render links.</p><h3 id="PageNavigation-7.Streamresponse">7. Stream response</h3><p>An event handler can also return a <a shape="rect" 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 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.
 </p><p>Not all pages have an 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). When no explicit activation context is provided, the page itself is queried for its activation context.</p><p>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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public class ProductDetail
 {
   private Product product;
 
@@ -283,34 +174,14 @@ public class ProductDetail
   long onPassivate() { return product.getId(); }
 }
 ]]></script>
-</div></div>
-
-<p>The activation context may consist of a series of values, in which case the return value of the method should be an array or a List.</p>
-
-    <div class="aui-message hint shadowed information-macro">
+</div></div><p>The activation context may consist of a series of values, in which case the return value of the method should be an array or a List.</p>    <div class="aui-message hint shadowed information-macro">
                             <span class="aui-icon icon-hint">Icon</span>
                 <div class="message-content">
-                            
-<p>Note: If you are using the <a shape="rect" href="hibernate-user-guide.html">tapestry-hibernate</a> integration library and your passivate context is a Hibernate entity, then you can just use the entity itself, not its id. Tapestry will automatically extract the entity's id into the URL, and convert it back for the "activate" event handler method.</p>
+                            <p>Note: If you are using the <a shape="rect" href="hibernate-user-guide.html">tapestry-hibernate</a> integration library and your passivate context is a Hibernate entity, then you can just use the entity itself, not its id. Tapestry will automatically extract the entity's id into the URL, and convert it back for the "activate" event handler method.</p>
                     </div>
     </div>
-
-
-<h2 id="PageNavigation-Pageactivation">Page activation</h2>
-
-<p>When a page render request arrives, the page is activated before it is rendered.</p>
-
-<p>Activation serves two purposes:</p>
-
-<ul><li>It allows the page to restore its internal state from data encoded into the URL (the activation context discussed above).</li><li>It provides coarse approach to validating access to the page.<br clear="none">
-The later case, validation, is generally concerned with user identity and access; if you have pages that may only be accessed by certain users, you may use the page's activate event handler responsible for verifying that access.</li></ul>
-
-
-<p>A page's activate event handler mirrors its passivate handler:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  . . .
+<h2 id="PageNavigation-Pageactivation">Page activation</h2><p>When a page render request arrives, the page is activated before it is rendered.</p><p>Activation serves two purposes:</p><ul><li>It allows the page to restore its internal state from data encoded into the URL (the activation context discussed above).</li><li>It provides coarse approach to validating access to the page.<br clear="none"> The later case, validation, is generally concerned with user identity and access; if you have pages that may only be accessed by certain users, you may use the page's activate event handler responsible for verifying that access.</li></ul><p>A page's activate event handler mirrors its passivate handler:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  . . .
 
   void onActivate(long productId)
   {
@@ -319,35 +190,13 @@ The later case, validation, is generally
 
   . . .
 ]]></script>
-</div></div>
-
-<p>Here's the relevant part: when the page renders, it is likely to include more component event request URLs (links and forms). The component event requests for those links and forms will <em>also</em> start by activating the page, before performing other work. This forms an unbroken chain of requests that include the same activation context.</p>
-
-<p>To some degree, this same effect could be accomplished using a <a shape="rect" href="persistent-page-data.html">persistent page value</a>, but that requires an active session, and the result is not bookmarkable.</p>
-
-<p>The activate event handler may also return a value, which is treated identically to a return value of a component event request event trigger. This will typically be used in an access validation scenario.</p>
-
-<h2 id="PageNavigation-PageNavigationPatterns">Page Navigation Patterns</h2>
-
-<p>This combination of action links and context and page context can be put together in any number of ways.</p>
-
-<p>Let's take a typical master/detail relationship using the concept of a product catalog page. In this example, the ProductListing page is a list of products, and the ProductDetails page must display the details for a specific product.</p>
-
-<h3 id="PageNavigation-Pattern1:Componenteventrequests/PersistentData">Pattern 1: Component event requests / Persistent Data</h3>
-
-<p>In this pattern, the ProductListing page uses action events and a persistent field on the ProductDetails page.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.html</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  &lt;t:loop source=&quot;products&quot; value=&quot;product&quot;&gt;
+</div></div><p>Here's the relevant part: when the page renders, it is likely to include more component event request URLs (links and forms). The component event requests for those links and forms will <em>also</em> start by activating the page, before performing other work. This forms an unbroken chain of requests that include the same activation context.</p><p>To some degree, this same effect could be accomplished using a <a shape="rect" href="persistent-page-data.html">persistent page value</a>, but that requires an active session, and the result is not bookmarkable.</p><p>The activate event handler may also return a value, which is treated identically to a return value of a component event request event trigger. This will typically be used in an access validation scenario.</p><h2 id="PageNavigation-PageNavigationPatterns">Page Navigation Patterns</h2><p>This combination of action links and context and page context can be put together in any number of ways.</p><p>Let's take a typi
 cal master/detail relationship using the concept of a product catalog page. In this example, the ProductListing page is a list of products, and the ProductDetails page must display the details for a specific product.</p><h3 id="PageNavigation-Pattern1:Componenteventrequests/PersistentData">Pattern 1: Component event requests / Persistent Data</h3><p>In this pattern, the ProductListing page uses action events and a persistent field on the ProductDetails page.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.html</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  &lt;t:loop source=&quot;products&quot; value=&quot;product&quot;&gt;
     &lt;a t:type=&quot;actionlink&quot; t:id=&quot;select&quot; context=&quot;product.id&quot;&gt;${product.name}&lt;/a&gt;
   &lt;/t:loop&gt;
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  @InjectPage
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @InjectPage
   private ProductDetails details;
 
   Object onActionFromSelect(long productId)
@@ -357,11 +206,8 @@ The later case, validation, is generally
     return details;
   }
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductDetails.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  @Inject
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductDetails.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Inject
   private ProductDAO dao;
 
   private Product product;
@@ -376,25 +222,8 @@ The later case, validation, is generally
     product = dao.getById(productId);
   }
 ]]></script>
-</div></div>
-
-<p>This is a minimal approach, perhaps good enough for a prototype.</p>
-
-<p>When the user clicks a link, the component event request URL will initially be something like "http://.../productlisting.select/99" and the final render request URL will be something like "http://.../productdetails". Notice that the product id ("99") does not appear in the render request URL.</p>
-
-<p>It has some minor flaws:</p>
-
-<ul><li>It requires a session (to store the productId field between requests).</li><li>It may fail if the ProductDetails page is accessed before a valid product id is set.</li><li>The URL does not indicate the identity of the product; if the user bookmarks the URL and comes back later, they will trigger the previous case (no valid product id).</li></ul>
-
-
-<p><span class="confluence-anchor-link" id="PageNavigation-activationpattern"></span> </p>
-<h3 id="PageNavigation-Pattern2:ComponentEventRequests/NoPersistentData">Pattern 2: Component Event Requests / No Persistent Data</h3>
-
-<p>We can improve the previous example without changing the ProductListing page, using a passivation and activation context to avoid the session and make the links more bookmarkable.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductDetails.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  @Inject
+</div></div><p>This is a minimal approach, perhaps good enough for a prototype.</p><p>When the user clicks a link, the component event request URL will initially be something like "http://.../productlisting.select/99" and the final render request URL will be something like "http://.../productdetails". Notice that the product id ("99") does not appear in the render request URL.</p><p>It has some minor flaws:</p><ul><li>It requires a session (to store the productId field between requests).</li><li>It may fail if the ProductDetails page is accessed before a valid product id is set.</li><li>The URL does not indicate the identity of the product; if the user bookmarks the URL and comes back later, they will trigger the previous case (no valid product id).</li></ul><p><span class="confluence-anchor-link" id="PageNavigation-activationpattern"></span></p><h3 id="PageNavigation-Pattern2:ComponentEventRequests/NoPersistentData">Pattern 2: Component Event Requests / No Persistent Data</h3><p>We
  can improve the previous example without changing the ProductListing page, using a passivation and activation context to avoid the session and make the links more bookmarkable.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductDetails.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Inject
   private ProductDAO dao;
 
   private Product product;
@@ -412,33 +241,16 @@ The later case, validation, is generally
 
   long onPassivate() { return productId; }
 ]]></script>
-</div></div>
-
-<p>This change ensures that the render request URL will include the product id, i.e., "http://.../productdetails/99".</p>
-
-<p>It has the advantage that the connection from page to page occurs in type-safe Java code, inside the onActionFromSelect method of ProductListing. It has the disadvantage that clicking a link requires two round trips to the server.</p>
-
-<h3 id="PageNavigation-Pattern3:RenderRequestsOnly">Pattern 3: Render Requests Only</h3>
-
-<p>This is the most common version of this master/detail relationship.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.html</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  &lt;t:loop source=&quot;products&quot; value=&quot;product&quot;&gt;
+</div></div><p>This change ensures that the render request URL will include the product id, i.e., "http://.../productdetails/99".</p><p>It has the advantage that the connection from page to page occurs in type-safe Java code, inside the onActionFromSelect method of ProductListing. It has the disadvantage that clicking a link requires two round trips to the server.</p><h3 id="PageNavigation-Pattern3:RenderRequestsOnly">Pattern 3: Render Requests Only</h3><p>This is the most common version of this master/detail relationship.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.html</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  &lt;t:loop source=&quot;products&quot; value=&quot;product&quot;&gt;
     &lt;a t:type=&quot;pagelink&quot; page=&quot;productdetails&quot; context=&quot;product.id&quot;&gt;${product.name}&lt;/a&gt;
   &lt;/t:loop&gt;
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-No code is needed to support the link.
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductListing.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[No code is needed to support the link.
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductDetails.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  @Inject
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ProductDetails.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Inject
   private ProductDAO dao;
 
   private Product product;
@@ -454,15 +266,7 @@ No code is needed to support the link.
 
   long onPassivate() { return productId; }
 ]]></script>
-</div></div>
-
-<p>The setProductId() method is no longer needed.</p>
-
-<h3 id="PageNavigation-Limitations">Limitations</h3>
-
-<p>As your application's workflow expands, you may find that there is not a reasonable way to avoid storing some data persistently between requests, outside of the page activation context. For example, if from the ProductDetails page, the user is allowed to navigate to related pages and then back to ProductDetails, it starts to become necessary to keep passing that product id around from page to page to page.</p>
-
-<p>At some point, persistent values make more sense. Tapestry has several persistence strategies available, including one that stores data in URL query parameters. See <a shape="rect" href="persistent-page-data.html">Persistent Page Data</a> for details.</p></div>
+</div></div><p>The setProductId() method is no longer needed.</p><h3 id="PageNavigation-Limitations">Limitations</h3><p>As your application's workflow expands, you may find that there is not a reasonable way to avoid storing some data persistently between requests, outside of the page activation context. For example, if from the ProductDetails page, the user is allowed to navigate to related pages and then back to ProductDetails, it starts to become necessary to keep passing that product id around from page to page to page.</p><p>At some point, persistent values make more sense. Tapestry has several persistence strategies available, including one that stores data in URL query parameters. See <a shape="rect" href="persistent-page-data.html">Persistent Page Data</a> for details.</p></div>
 </div>
 
 <div class="clearer"></div>