Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
langhtml
titleContainerComponent.tml
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.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
langhtml
titleIndex.tml
<t:ContainerComponent t:id="Container" t:page="About" />


 

There are still cases where you want to use the "inherit:" binding prefix. For example, if you have several components that need to share a parameter, then you must do it the Tapestry 5.0 way: a true parameter on the outer component, and "inherit:" bindings on the embedded components. You can follow a similar pattern to rename a parameter in the outer component.