You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Vaneet Sharma <Va...@iwg.info> on 2002/11/26 17:25:56 UTC

Question

hi guys,
  How can i put the template generated by velocity on my midlet ... ie. a java program on mobile.
 Does it works same way like retreiving data via XML 
  i want the result generated by my servlet to come over to my midlet.. java application running on mobile.
  thankx


-----Original Message-----
From: Jan Vesely [mailto:jan.vesely@quinity.com]
Sent: 26 November 2002 11:03
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



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>