...
Section |
---|
Column |
---|
Code Block |
---|
| xml | xml |
---|
title | This is right |
---|
| xml |
---|
|
<t:textfield t:id="color" value="color"/>
|
|
Column |
---|
Code Block |
---|
| xml | xml |
---|
title | This is wrong |
---|
| xml |
---|
|
<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 |
---|
|
<img src="${context:images/banner.png}"/>
|
|
Column |
---|
Code Block |
---|
| xml | xml |
---|
title | This is wrong |
---|
| xml |
---|
|
<img src="context:images/banner.png"/>
|
|
|
...
Inherited bindings are useful for complex components; they are often used when an inner component has a default value for a parameter, and the outer component wants to make it possible to override that default.
Code Block |
xml |
---|
|
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<body>
<div t:type="layout" t:menuTitle="literal:The Title">
...
</div>
</body>
</html>
|
Code Block |
---|
|
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<div t:type="title" t:title="inherit:menuTitle"></div>
<t:body />
</t:container>
|
Code Block |
java |
---|
|
package org.example.app.components;
import org.apache.tapestry5.annotations.Parameter;
public class Title {
@Parameter
private String title;
}
|
...
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 |
---|
| xml | xml |
---|
title | ContainerComponent.tml |
---|
| xml |
---|
|
<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 |
---|
title | ContainerComponent.java |
---|
|
public class ContainerComponent{
@Component(id="link", publishParameters="page")
private PageLink link;
}
|
Code Block |
---|
|
<t:ContainerComponent t:id="Container" t:page="About" />
|
...