Results 1 to 2 of 2

Thread: #foreach issue

  1. #1
    Join Date
    Jun 2005
    Posts
    4

    Default #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. #2
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    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

Similar Threads

  1. Workaround for BeanUtils Issue in Spring??
    By tdanecito in forum Container
    Replies: 4
    Last Post: Apr 5th, 2006, 02:26 PM
  2. Replies: 5
    Last Post: Aug 11th, 2005, 02:38 AM
  3. Service layer design issue
    By raz0red in forum Data
    Replies: 2
    Last Post: Apr 17th, 2005, 07:23 AM
  4. PageCompononentListener Hooks...JIRA issue?
    By amcauley in forum Swing
    Replies: 9
    Last Post: Apr 15th, 2005, 06:10 AM
  5. Replies: 3
    Last Post: Dec 8th, 2004, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •