Announcement Announcement Module
Collapse
No announcement yet.
#foreach issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #foreach issue

    Hi Forum,
    I'm returning the Map of objects on call of getLiabilitiesMap() if I print $liabilitiesMap output is - showing proper count of 4 elements, but if I use

    #foreach( $temp in $liabilitiesMap )
    $temp
    #end

    I get a blank output with warning on console as -
    [ WARN] (org.apache.velocity.app.VelocityEngine): Could not determine type of iterator in #foreach loop at [0,0] in template ConfirmationEmail.vm

    Any directions on this issue?
    Thanks,
    Mo.

  • #2
    Map doesn't implement Iterator, you need to iterate over the set of values, set of keys for the entrySet.

    for #forEach ($temp in $liabilitiesMap.entrySet)

    would make $temp a Map.ENTRY object,

    for #forEach ($temp in $liabilitiesMap.values)

    would make $temp one of the values in the map,

    for #forEach ($temp in $liabilitiesMap.keySet

    would make $temp one of the keys in the map.

    Read http://java.sun.com/j2se/1.4.2/docs/.../util/Map.html

    Comment

    Working...
    X