Andrey, Andrey Kudryavtsev wrote: > It's ok. But I try to iterate it: > #foreach( $taskList in $otherTaskLists )$taskList #end
It looks like Velocity automatically calls the "values" method on
anything that implements Map. See near line 119 in UberspectImpl.java:
else if (obj instanceof Map)
{
return ((Map) obj).values().iterator();
}
Your VTL is iterating over a collection of values.
> Where are the keys? And how to show them?
The keys are lost, since the Uberspector calls values().
If you want to iterate over the entries in your map, you'll have to do this:
#foreach($entry in $otherTaskLists)
$entry.key <!-- gets the key for the task -->
$entry.value <!-- gets the value for the task -->
#end
> I can do the same in JSTL, and
> it works there through ${taskList.key}
It's not surprising that syntax from another content generation system
doesn't work properly in Velocity. :(
-chris
signature.asc
Description: OpenPGP digital signature
