To pass more parameters in a context, use square brackets and commas, and single quotes for literals.
For example t:context="['view',personId]"
would render a URL like this: http://thehost/jumpstart/examples/navigation/MoreParameters2/view/1
.
<!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
We use a "strict" DTD to make IE follow the alignment rules. -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<body class="container">
<h3>More Parameters (1)</h3>
<p>To pass more parameters in a context, use square brackets and commas, and single quotes for literals.</p>
<p>For example <code>t:context="['view',personId]"</code>
would render a URL like this: <code>http://thehost/jumpstart/examples/navigation/MoreParameters2/view/1</code>.</p>
<div class="eg">
<t:pagelink page="examples/navigation/MoreParameters2" context="[anInt,aLong,aString,aDouble,aBigDecimal,aBoolean,aMode,'create']">
Pass many parameters
</t:pagelink><br/>
</div>
References:
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/components/PageLink.html">PageLink</a>,
<a href="http://tapestry.apache.org/page-navigation.html#PageNavigation-PageRenderRequests">Page Render Requests</a>,
<a href="http://tapestry.apache.org/page-navigation.html#PageNavigation-Pageactivation">Page Activation</a>,
<a href="http://tapestry.apache.org/property-expressions.html#PropertyExpressions-Grammar">Grammar</a>,
<a href="http://tapestry.apache.org/component-parameters.html#ComponentParameters-BindingExpressions">Binding Expressions</a>,
<a href="http://tapestry.apache.org/typecoercer-service.html">Type Coercion</a>.<br/><br/>
<t:pagelink t:page="Index">Home</t:pagelink><br/><br/>
<t:tabgroup>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/navigation/MoreParameters1.tml"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/navigation/MoreParameters1.java"/>
<t:sourcecodetab src="/web/src/main/resources/META-INF/assets/css/examples/olive.css"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/models/Mode.java"/>
</t:tabgroup>
</body>
</html>
package jumpstart.web.pages.examples.navigation;
import java.math.BigDecimal;
import jumpstart.web.models.Mode;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Property;
@Import(stylesheet = "css/examples/olive.css")
public class MoreParameters1 {
@Property
private int anInt;
@Property
private Long aLong;
@Property
private String aString;
@Property
private double aDouble;
@Property
private BigDecimal aBigDecimal;
@Property
private boolean aBoolean;
@Property
private Mode aMode;
void setupRender() {
anInt = 1;
aLong = new Long(2);
aString = "3";
aDouble = 4.321;
aBigDecimal = new BigDecimal("5.432");
aBoolean = true;
aMode = Mode.REVIEW;
}
}
.eg {
margin: 20px 0;
padding: 14px;
color: olive;
border: 1px solid #ddd;
border-radius: 6px;
-webkit-border-radius: 6px;
-mox-border-radius: 6px;
}
package jumpstart.web.models;
public enum Mode {
CREATE, REVIEW, UPDATE, DELETE;
}