How to render a block parameter in component
Joshua Richardson <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.user |
|---|---|
| Message-ID | <BY2PR15MB08889020089198AB80E472ACE99D0@BY2PR15MB0888.namprd15.prod.outlook.com> |
I want to pass a block of rendered html as a component parameter. After 2hrs searching I have been unable to find the right doc or example. I have a suspicion that it may involve creating a render() handler, but I'm hoping there's a simpler way.
public class Layout {
@Property
@Parameter(required = false)
private Block headerContent;
}
layout.tml >> EOF
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
>
<body>${prop:headerContent}</body>
</html>
EOF
page.tml >> EOF2
<html t:type="layout" title="site Index"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
xmlns:p="tapestry:parameter"
>
<p:headerContent>
content rendered at page level
</p:headerContent>
</html>
EOF2
expected output >> EOF3
<html>
<body>content rendered at page level</body>
</html>
EOF3
actual output >> EOF4
<html>
<body>Block[Parameter headerContent of Index:layout, at classpath:com/example/pages/Index.tml, line 6]</body>
</html>
EOF4