velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Foth, Oliver" <Oliver.F...@gedas.de>
Subject AW: variable display problem
Date Mon, 14 Oct 2002 10:24:34 GMT
Thank you so much guys! :-)
I just tried out the ArrayList and it workes perfectly!

Regards,

Olli

-----Urspr├╝ngliche Nachricht-----
Von: Geir Magnusson Jr. [mailto:geirm@optonline.net] 
Gesendet: Montag, 14. Oktober 2002 11:51
An: velocity-user@jakarta.apache.org
Betreff: Re: variable display problem


You can just use an ArrayList :

 List list = new ArrayList();

 for(i=0; i < something.length(); i++)
 {
   ....
    list.add(aufdat);
 }

 context.put("aufdatList", list);


And then in your template :

  #foreach($aufdat in $aufdatList)
        $aufdat<br>
  #end

Or 

   $aufdatList.get(3)

for direct access

On 10/14/02 3:36 AM, "Foth, Oliver" <Oliver.Foth@gedas.de> wrote:

> Hi everybody,
> 
> I have the following problem, or better: challenge ;-)
> In a java file I've created some variables within an for loop:
> 
> for (i = 0, i < something.length(), i++)
> {
>  ...
>  context.put("aufdat_"+i, aufdat);
>  ...
> }
> 
> I can use them in the vm file and they are displayed correctly. But 
> instead of using them like:
> 
> $aufdat_1<BR/>
> $aufdat_2<BR/>
> ...
> 
> I need to use them in another loop:
> 
> #set ($index = 0)
> #foreach ($thing in $something)
>  #set ($index = $index + 1)
>  $aufdat_$index
> #end
> 
> How can I have "$aufdat_$index" displayed correctly?
> 
> 
> Gru├č,
> 
> Oliver Foth
>> ----------------------------------------------------
>> gedas deutschland GmbH
>> Teilelogistik
>> Johann-Siegmund-Schuckert-Str. 2a
>> D-34225 Baunatal
>> Telefon/phone    +49-561-49995-34
>> Telefax/telefax    +49-561-49995-52
>> Mailto: Oliver.Foth@gedas.de
>> http://www.gedas.com <http://www.gedas.com>
>> ----------------------------------------------------
>> 
>> 
> 

-- 
Geir Magnusson Jr. 
geirm@adeptra.com                                    +1-203-355-2219 (w)
Adeptra Inc.                                         +1-203-247-1713 (m)



--
To unsubscribe, e-mail:
<mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:velocity-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message