Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Section
Column
Code Block
xmlxml
titleThis is right
xml
<t:textfield t:id="color" value="color"/>
Column
Code Block
xmlxml
titleThis 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
xml
Code Block
xml
titleThis is right
xml
<img src="${context:images/banner.png}"/>
Column
Code Block
xmlxml
titleThis 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.

xml
Code Block
xml
titleIndex.tml
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
xmlxml
titleLayout.tml
xml
<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>
java
Code Block
java
titleTitle.java
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
xmlxml
titleContainerComponent.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
titleContainerComponent.java
public class ContainerComponent{
@Component(id="link", 	publishParameters="page")
private PageLink link;
}
Code Block
xmlxml
titleIndex.tml
xml
<t:ContainerComponent t:id="Container" t:page="About" />

...