Let's say we want the Another page to display the message we entered at the Start page. First of all, we need to provide a property to store the passed value. Modify the Another
page class (Another.java
file) to look similar to this:
package com.packtpub.t5first.pages; public class Another { private String passedMessage; public String getPassedMessage() { return passedMessage; } public void setPassedMessage(String passedMessage) { this.passedMessage = passedMessage; } }
Next, let's use an expansion to display the passed message at the Another page. Modify the Another
page template to look like this:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>Another Page</title>
</head>
<body>
<h1>Another Page</h1>
<p>Received a new message: ${passedMessage}</p>
<p>
<t:PageLink t:page="Start">Back to the Start
page</t:PageLink>
</p>
</body>
<...