Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor: set {code} tag language consistently

...

You generally should not use the Template Expansion syntax, ${...}, within component parameter bindings. Doing so results in the property inside the braces being converted to an (immutable) string, and will therefore result in a runtime exception if your component needs to update the value (whenever the default or explicit binding prefix is prop: or var:, since such component parameters are two-way bindings).

Section
Column
Code Block
xml
xml
titleThis is right
<t:textfield t:id="color" value="color"/>
Column
Code Block
xml
xml
titleThis is wrong
<t:textfield t:id="color" value="${color}"/>

The general rule is, only use the ${...} syntax in non-Tapestry-controlled locations in your template, such as in attributes of ordinary HTML elements and in plain-text areas of your template.

Section
Column
Code Block
xml
xml
titleThis is right
<img src="${context:images/banner.png}"/>
Column
Code Block
xml
xml
titleThis is wrong
<img src="context:images/banner.png"/>

...

In Tapestry 5.1 and later, you may use the publishParameters attribute of the @Component annotation. List one or more parameters separated by commas: those parameters of the inner/embedded component become parameters of the outer component. You should not define a parameter field in the outer component.

Code Block
langxml
htmlxml
titleContainerComponent.tml
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<t:pageLink t:id="link">Page Link</t:pageLink>
</t:container>
Code Block
titleContainerComponent.java
public class ContainerComponent{
@Component(id="link", 	publishParameters="page")
private PageLink link;
}
Code Block
langxml
htmlxml
titleIndex.tml
<t:ContainerComponent t:id="Container" t:page="About" />

...