April 12, 2007

Tapestry 5: Rendering a Block in a page


This one took awhile to figure out. In Tapestry, if a component is passed to another component (such as your main page layout component), you need to pass it as a Block parameter. The problem with blocks, there is no quick way to render them. You can use the @AfterRenderBody rendering stage annotation, but this gives you very limited flexibility in where the object will end up (or you make kludgy hacks to put this together). This quick little component can solve all those problems. I present you Render.java. This incredible class is appearing in IRM 2. Update: You can also use the builtin Tapestry component named Delegate. <t:delegate to=“block:foo”/> But if you still prefer, you can use this Component: Read more

© 2025 Yann Ramin