logo       

RE: #foreach help needed ...: msg#00171

jakarta.velocity.user

Subject: RE: #foreach help needed ...

Do you have getters for the address-properties? Like
Address.getStreet()?
And are they public? Could you please send the Java-Files too, if the
problem persists?

I don't see any problem besides the property-thing (at the moment).

Peter

> -----Original Message-----
> From: Jan Vesely [mailto:jan.vesely@xxxxxxxxxxx]
> Sent: Tuesday, November 26, 2002 11:03 AM
> To: Velocity Users List
> 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