Hi,
The trick is in the following line:
<comp jwcid="@For" source="ognl:menuItems" value="ognl:menuItem">
Basically, the currently rendered node is placed in the menuItem
property and the getMenuItems() function must return the children of the
node currently in menuItem.
Here is some example code:
public List getMenuItems() {
List items;
Customer item = getMenuItem();
// fill 'items' with the children of the 'item' node
if (item == null)
items = (List) personMap.get(new Integer(0)); // 0 is the root
else
items = (List) personMap.get(new Integer(item.getId()));
return items;
}
Also, please make sure you use a recent beta -- I am not sure your code
would work in an old one.
Dan Adams wrote:
Hey, can you explain a little more how the below works? Right now I'm
trying to get something similar working but for some reason it's going
into an infinite loop in that it keeps asking for the children of the
root node rather than actually drilling down.
On Fri, 2005-11-04 at 22:09 +0200, Mind Bridge wrote:
Hi,
> For example common framework components (like Foreach, If, etc.)
cache their parameters.
Actually, they used to, but they do not anymore and can participate in
recursion. See http://issues.apache.org/jira/browse/TAPESTRY-654?page=all.
The following works well, for example:
<comp jwcid="@RenderBlock" block="ognl:components.subMenuItems"/>
<comp jwcid="[EMAIL PROTECTED]">
<comp jwcid="@For" source="ognl:menuItems" value="ognl:menuItem">
<comp jwcid="@Insert" value="ognl:menuItem.fullName"/><br/>
<comp jwcid="@If" condition="ognl:menuItems != null">
<comp jwcid="@Insert" value=" "/>
<comp jwcid="@RenderBlock"
block="ognl:components.subMenuItems"/>
</comp>
</comp>
</comp>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]