logo       

#foreach help needed ...: msg#00170

jakarta.velocity.user

Subject: #foreach help needed ...

Hi everyone,

I wonder if the following thing is possible, and if it is, how to make Velocity
do it...(i simplify the real situation & use different classes, but the problem
is the same):


I have one class, say class Person with following fields: String name,
ArrayList addresses
Then I have another class, Address, with fields String street, String city -
you can guess, the ArrayList addresses in Person is filled with instances of
the class Address.
And I have a wrapper ArrayList People.

Now I want to print all the information I have
so I do

#foreach($person in $people)
$person.name
#foreach($address in $person.addresses)
$address.street
$address.city
#end
#end

However, I do not get the address data ... anyone any idea why? I do not have
any problems with accessing simple stuf like String inside an ArrayList. I also
do not have any problems with getting the whole Address object (which is, of
course, gibberish when printed as it is). What I cannot achieve is to acces the
fields of the Address object from the ArrayList ....

Thanks!!!

Jan


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise