Modified: websites/production/tapestry/content/component-parameters.html
==============================================================================
--- websites/production/tapestry/content/component-parameters.html (original)
+++ websites/production/tapestry/content/component-parameters.html Fri May 1
00:29:08 2020
@@ -19,24 +19,24 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="keywords" content="tapestry, apache, apache tapestry, frameowrk,
java, web, component, open source, application, dynamic, scalable, robust,
servlet">
+ <meta name="keywords" content="tapestry, apache, apache tapestry, framework,
java, web, component, open source, application, dynamic, scalable, robust,
servlet">
<meta name="description" content="Apache Tapestry is a open-source
component-oriented framework for creating dynamic, robust, highly scalable web
applications in Java. Tapestry complements and builds upon the standard Java
Servlet API, and so it works in any servlet container or application server.">
<title>
Component Parameters - Apache Tapestry
</title>
- <link rel="apple-touch-icon-precomposed" sizes="144x144"
href="images/apache-tapestry-5-icon-144.png">
- <link rel="apple-touch-icon-precomposed" sizes="114x114"
href="images/apache-tapestry-5-icon-114.png">
- <link rel="apple-touch-icon-precomposed" sizes="72x72"
href="images/apache-tapestry-5-icon-72.png">
- <link rel="apple-touch-icon-precomposed"
href="images/apache-tapestry-5-icon-57.png">
- <link rel="shortcut icon" href="images/apache-tapestry-5-icon-32.png">
+ <link rel="apple-touch-icon-precomposed" sizes="144x144"
href="/images/apache-tapestry-5-icon-144.png">
+ <link rel="apple-touch-icon-precomposed" sizes="114x114"
href="/images/apache-tapestry-5-icon-114.png">
+ <link rel="apple-touch-icon-precomposed" sizes="72x72"
href="/images/apache-tapestry-5-icon-72.png">
+ <link rel="apple-touch-icon-precomposed"
href="/images/apache-tapestry-5-icon-57.png">
+ <link rel="shortcut icon" href="/images/apache-tapestry-5-icon-32.png">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Sarabun:ital,wght@0,400;0,700;1,400;1,700&display=swap">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/themes/prism.min.css">
- <link rel="stylesheet" href="/styles/main.css">
+ <link rel="stylesheet" href="/styles/main.css">
<script type="text/javascript">
if (window.location.protocol === 'http:' && window.location.hostname !==
'localhost') {
@@ -55,7 +55,7 @@
ga('create', 'UA-400821-1', 'auto');
ga('send', 'pageview');
</script>
- <script async src='https://www.google-analytics.com/analytics.js'></script>
+ <script async src="https://www.google-analytics.com/analytics.js"></script>
</head>
<body>
<!-- /// Navigation Start -->
@@ -247,11 +247,11 @@
</div></div><p>A component may have any number of parameters. Each parameter
has a specific name, a specific Java type (which may be a primitive value), and
may be <em>optional</em> or <em>required</em>.</p><p>Within a component class,
parameters are declared by using the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Parameter.html">Parameter</a>
annotation on a private field, as we'll see below.</p><p><span
class="confluence-anchor-link"
id="ComponentParameters-bindingparameters"></span></p><h1
id="ComponentParameters-ParameterBindings">Parameter Bindings</h1><p>In
Tapestry, a parameter is not a slot into which data is pushed: it is a
<em>connection</em> between a field of the component (marked with the
@Parameter annotation) and a property or resource of the component's container.
(Components can be nested, so the container can be either the page or another
component.)</p><div class="navmenu" style="float:right; backgro
und:white; margin:3px; padding:3px">
<div class="panel" style="border-width: 1px;"><div class="panelHeader"
style="border-bottom-width: 1px;"><b>Contents</b></div><div
class="panelContent">
<style type="text/css">/*<![CDATA[*/
-div.rbtoc1588040605930 {padding: 0px;}
-div.rbtoc1588040605930 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1588040605930 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1588292635831 {padding: 0px;}
+div.rbtoc1588292635831 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1588292635831 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1588040605930">
+/*]]>*/</style><div class="toc-macro rbtoc1588292635831">
<ul class="toc-indentation"><li><a
href="#ComponentParameters-ParameterBindings">Parameter Bindings</a></li><li><a
href="#ComponentParameters-BindingExpressions">Binding
Expressions</a></li><li><a
href="#ComponentParameters-@Parameterannotation">@Parameter
annotation</a></li><li><a
href="#ComponentParameters-Don'tusethe${...}syntax!">Don't use the ${...}
syntax!</a></li><li><a href="#ComponentParameters-InformalParameters">Informal
Parameters</a></li><li><a
href="#ComponentParameters-ParametersAreBi-Directional">Parameters Are
Bi-Directional</a></li><li><a
href="#ComponentParameters-InheritedParameterBindings">Inherited Parameter
Bindings</a></li><li><a
href="#ComponentParameters-ComputedParameterBindingDefaults">Computed Parameter
Binding Defaults</a></li><li><a
href="#ComponentParameters-UnboundParameters">Unbound Parameters</a></li><li><a
href="#ComponentParameters-ParameterTypeCoercion">Parameter Type
Coercion</a></li><li><a href="#ComponentParameters-ParameterNames">Parameter N
ames</a></li><li><a href="#ComponentParameters-DeterminingifBound">Determining
if Bound</a></li><li><a
href="#ComponentParameters-PublishingParameters">Publishing
Parameters</a></li></ul>
</div>
</div></div></div> <p>The connection between a component and a property
(or resource) of its container is called a <em>binding</em>. The binding is
two-way: the component can read the bound property by reading its parameter
field. Likewise, a component that updates its parameter field will update the
bound property.</p><p>This is important in a lot of cases; for example a
TextField component can read <em>and update</em> the property bound to its
value parameter. It reads the value when rendering, but updates the value when
the form is submitted.</p><p>The component listed below is a looping component;
it renders its body a number of times, defined by its <code>start</code> and
<code>end</code> parameters (which set the boundaries of the loop). The
component can update a <code>result</code> parameter bound to a property of its
container; it will automatically count up or down depending on whether
<code>start</code> or <code>end</code> is larger.</p><div class="code panel
pdl" st
yle="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -313,7 +313,7 @@ public class Count
</p>
</html>
</code></pre>
-</div></div><p>The end attribute is used to <em>bind</em> the end parameter of
the Count component. Here, it is being bound to the string value "3", which is
automatically <a href="type-coercion.html">coerced</a> by Tapestry into the int
value, 3.</p><p>Any number of parameters may be bound this way.</p><p>Component
parameters may also be bound using the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Component.html">Component</a>
annotation inside the component class. (Where conflicts occur, the parameters
bound using the Component annotation will take precedence over parameter
bindings in the template.)</p><p><span class="confluence-anchor-link"
id="ComponentParameters-binding-expressions"></span></p><h1
id="ComponentParameters-BindingExpressions">Binding Expressions</h1><p>The
value inside the template, "3" in the previous example, is a <em>binding
expression</em>.</p><p>By placing a prefix in front of the value, you can
change how Tapestry interprets the remainder of the expression (the part
after the colon):</p><div class="table-wrap"><table class="table
table-bordered"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p><strong>Prefix</strong></p></th><th colspan="1"
rowspan="1"
class="confluenceTh"><p><strong>Description</strong></p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>asset:</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The relative path to an asset file (which
must exist)</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>block:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The id of a block within the
template</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>component:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The id of another component within the same
template</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>context:</p></td><td colspan="1" rowspan
="1" class="confluenceTd"><p>Context asset: path from context
root</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>literal:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A literal string</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>nullfieldstrategy:</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Used to locate a pre-defined <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/NullFieldStrategy.html">NullFieldStrategy</a></p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>message:</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Retrieves a string from the
component's <a href="localization.html">message
catalog</a></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>prop:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A <a href="property-expressions.html">property
expression</a> to read or update</p></td></tr><tr
><td colspan="1" rowspan="1" class="confluenceTd"><p>symbol:</p></td><td
>colspan="1" rowspan="1" class="confluenceTd"><p>Used to read one of your <a
>href="symbols.html">symbols</a></p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p>translate:</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>The name of a configured
>translator</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p>validate:</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>A <em>validator specification</em> used to create
>some number of field validators</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p>var:</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>Allows a render variable of the component to be read
>or updated</p></td></tr></tbody></table></div><p>Most of these binding
>prefixes allow parameters to be bound to read-only values; for instance a
>parameter bound to "message:some-key" will see the message for "some-key"
>from its cont
ainer's message catalog in the field. If the component tries to update the
parameter (by setting the value of the field), a runtime exception will be
thrown to indicate that the value is read-only.</p><p>Only prop: and var:
binding prefixes are updateable (but you must <em>not</em> use the ${..} syntax
here; see the <a href="component-parameters.html">warning
below</a>).</p><p>Each parameter has a default prefix, defined by the
component, that is used when the prefix is not provided. The most common are
"literal:" and "prop:".</p><p>A <em>special prefix</em>, "inherit:", is used to
support <a href="component-parameters.html">Inherited Parameter
Bindings</a>.</p><h3 id="ComponentParameters-RenderVariables:Bindings">Render
Variables: Bindings</h3><p>Components can have any number of <em>render
variables</em>. Render variables are named values with no specific type (they
are ultimately stored in a Map). Render variables are useful for holding simple
values, such as loop indices, that n
eed to be passed from one component to another.</p><p>For example, the
following template code:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The end attribute is used to <em>bind</em> the end parameter of
the Count component. Here, it is being bound to the string value "3", which is
automatically <a href="type-coercion.html">coerced</a> by Tapestry into the int
value, 3.</p><p>Any number of parameters may be bound this way.</p><p>Component
parameters may also be bound using the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Component.html">Component</a>
annotation inside the component class. (Where conflicts occur, the parameters
bound using the Component annotation will take precedence over parameter
bindings in the template.)</p><p><span class="confluence-anchor-link"
id="ComponentParameters-binding-expressions"></span></p><h1
id="ComponentParameters-BindingExpressions">Binding Expressions</h1><p>The
value inside the template, "3" in the previous example, is a <em>binding
expression</em>.</p><p>By placing a prefix in front of the value, you can
change how Tapestry interprets the remainder of the expression (the part
after the colon):</p><div class="table-wrap"><table class="table table-bordered
table-responsive"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p><strong>Prefix</strong></p></th><th colspan="1"
rowspan="1"
class="confluenceTh"><p><strong>Description</strong></p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>asset:</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The relative path to an asset file (which
must exist)</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>block:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The id of a block within the
template</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>component:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The id of another component within the same
template</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>context:</p></td><td co
lspan="1" rowspan="1" class="confluenceTd"><p>Context asset: path from context
root</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>literal:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A literal string</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>nullfieldstrategy:</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Used to locate a pre-defined <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/NullFieldStrategy.html">NullFieldStrategy</a></p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>message:</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Retrieves a string from the
component's <a href="localization.html">message
catalog</a></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>prop:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A <a href="property-expressions.html">property
expression</a> to read or update
</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>symbol:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Used to read one of your <a
href="symbols.html">symbols</a></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>translate:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The name of a configured
translator</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>validate:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A <em>validator specification</em> used to create some
number of field validators</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>var:</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Allows a render variable of the component to be read or
updated</p></td></tr></tbody></table></div><p>Most of these binding prefixes
allow parameters to be bound to read-only values; for instance a parameter
bound to "message:some-key" will see the message for "some-k
ey" from its container's message catalog in the field. If the component tries
to update the parameter (by setting the value of the field), a runtime
exception will be thrown to indicate that the value is read-only.</p><p>Only
prop: and var: binding prefixes are updateable (but you must <em>not</em> use
the ${..} syntax here; see the <a href="component-parameters.html">warning
below</a>).</p><p>Each parameter has a default prefix, defined by the
component, that is used when the prefix is not provided. The most common are
"literal:" and "prop:".</p><p>A <em>special prefix</em>, "inherit:", is used to
support <a href="component-parameters.html">Inherited Parameter
Bindings</a>.</p><h3 id="ComponentParameters-RenderVariables:Bindings">Render
Variables: Bindings</h3><p>Components can have any number of <em>render
variables</em>. Render variables are named values with no specific type (they
are ultimately stored in a Map). Render variables are useful for holding simple
values, such as loo
p indices, that need to be passed from one component to another.</p><p>For
example, the following template code:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre><code class="language-xml"><ul>
<li t:type="loop" source="1..10" value="index">${index}</li>
</ul>
@@ -529,4 +529,4 @@ public class Title {
</footer><br clear="none"></p><p><br clear="none"></p></div>
<!-- /// Footer End -->
</body>
-</html>
\ No newline at end of file
+</html>