Re: How to render a block parameter in component
Carlos Montero Canabal <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.user |
|---|---|
| Message-ID | <[email protected]> |
Hi! To render a block you have to write <t:deletage to=“headerContent”/> So, in your layout.ml file: <body> <t:deletage to=“headerContent”/> </body> > El 31/8/2017, a las 8:46, Joshua Richardson <[email protected]> escribió: > > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]