Tuesday December 07, 2004 You can do this in tiles-defs.xml
<definition name=".dog" extends=".animal.layout">
<put name="body" value=".dog.display" />
<put name="head" value=".dog.head" />
</definition>
<definition name=".cosmos.head" extends=".head">
<put name="titleKey" value="dog.title" />
</definition>
<definition name=".dog.display"
controllerUrl="/dog.do"
path="/tile/dog.vm"
/>
and so forth. Declaritive tile composition works just fine. But what about programmatic composition at runtime?
With JSTL and struts, I can do this:
<c:forEach var="bit" items="${kibble}">
<tiles:insert page="/tile/bark.jsp">
<tiles:put name="bit" beanName="bit" />
</tiles:insert>
</c:forEach>
I would imagine that the Velocity equivalent would look like this:
<ol>
#foreach ($bit in $kibble)
$tiles.put("/tile/bark.vm", { "bit" : $bit })
#end
</ol>
but alas, it's not implemented by TilesTool. I can work around this by moving "bark.vm" to its own velocimacro but that it fugly as hell. I would prefer parameterized components.
( Dec 07 2004, 06:53:07 AM PST )
Permalink