<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- We need a doctype to allow us to use special characters like &nbsp;
We use a "strict" DTD to make IE follow the alignment rules. -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<head>
<style type="text/css">
.noeg { padding-bottom: 14px; }
</style>
</head>
<body class="container">
<h3>Passing Data Between Pages</h3>
Tapestry's policy of doing <a href="http://en.wikipedia.org/wiki/Post/Redirect/Get">Post/Redirect/Get</a> can make it a
bit tricky for an event request to result in data being passed to the next page.<br/>
Here are 5 ways to do it:<br/>
<ul>
<li>
<strong>By Activation Context</strong><br/>
This is the most used technique. It's usually employed to pass an <strong>identifier</strong>, eg. productId.
<div class="eg">
<t:form t:id="useactivationcontext">
<t:eventlink event="useActivationContext">Use activation context to pass id <em>1</em></t:eventlink>.
</t:form>
</div>
</li>
<li>
<strong>By Query String</strong><br/>
This may be the most appropriate way to pass <strong>filter criteria</strong> because,
arguably, it produces the most RESTful URL in that situation.
<div class="eg">
<t:form t:id="usequerystring">
<t:eventlink event="useQueryString">Use query string to pass partial name = <em>humpty</em></t:eventlink>.
</t:form>
</div>
</li>
<li>
<strong>By Persist</strong><br/>
This is usually the most appropriate way to pass <strong>whole objects, lengthy data, or data you don't
want to be visible in a URL</strong>
<div class="eg">
<t:form t:id="usepersist">
<t:eventlink event="usePersist">Use @Persist to pass a Person's first and last name</t:eventlink>.
</t:form>
</div>
</li>
<li class="noeg">
<strong>By Session State Objects</strong><br/>
This is the best way to share data <strong>between multiple pages</strong> as in a <strong>wizard or a shopping basket</strong>.<br/>
See the <em>Sharing Across Multiple Pages</em> example.
</li>
<li>
<strong>By Services</strong><br/>
This is the best way to share an object <strong>across the whole application</strong>.<br/>
See the <em>Sharing Across the Application</em> example.
</li>
</ul>
<t:pagelink page="Index">Home</t:pagelink><br/><br/>
<t:tabgroup>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/state/PassingDataBetweenPages.tml"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/state/PassingDataBetweenPages.java"/>
<t:sourcecodetab src="/web/src/main/resources/META-INF/assets/css/examples/plain.css"/>
</t:tabgroup>
</body>
</html>