instead of 
      #set($fieldValues = $row.getFieldValues)
try
      #set($fieldValues = $row.getFieldValues())

I think velocity needs the () at the end of a method call such as
key.toUpperCase()

-----Original Message-----
From: Qin Ding [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 10:48 AM
To: [EMAIL PROTECTED]
Subject: How to handle the nested Loop


I have in velocityContext a Hashtable.  The key is String type and value is
a ArrayList.
The arraylist holds number of java beans.  The each bean has a method
getFieldValues(), which returns an array
String[ ].  Now I try to print out each String value in the String[ ]
array.  I tested in java code to print out the value in the array; but in
my velocity template, I can't print anything.  I don't know why.  I don't
even know if this is the correct way of doing these nested looping.

#foreach( $key in $OFFENDIGN_ROWS.keySet() )
---------------> get key
    #set($upperKey = "${key.toUpperCase()}")
    <a class="large" name="${key}" id="${key}">${upperKey}</a>

    TABLE border="1" width="100%" cellspacing="0">
      #foreach( $field in $BEAN_FIELD_NAMES )
      <TH class="highlight">$field.Property</TH>
-----------------> This is ok
      #end

      #foreach( $rows in $OFFENDIGN_ROWS.get($key) )
-----------------> get the arrayList associated with key
      #foreach ($row in $rows)
------------------> get bean in the list

      #set($fieldValues = $row.getFieldValues)
------------------>  get the String[ ] array of the bean
      <TR>
      #foreach( $fieldValue in $fieldValues )
-------------------> get the String value from the array
        <TD> $fieldValue </TD>
--------------------> display nothing
      #end
      </TR>

      #end
      #end
    </TABLE>
    </p>
    #end

Did I do something wrong? Thank you.

Qin


----------------------------------------------------------------------------
------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------
------------





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to