velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Revusky <revu...@wanadoo.es>
Subject Re: variable display problem
Date Mon, 14 Oct 2002 08:18:16 GMT
On Monday 14 October 2002 09:36 am, Foth, Oliver 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);
>    ...
> }

It seems to me that you should just put the variables in an ArrayList.

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

and then in the VM file, use:

$aufdatei.get($index)

etcetera.

(Pity you can't just write ${aufdatei[index]} like in FreeMarker. ;-))

Hope that helps,

Jonathan Revusky
--
FreeMarker-Velocity comparison doc
http://freemarker.sourceforge.net/fmVsVel.html
Velocity->FreeMarker template conversion utility
http://freemarker.sourceforge.net/usCavalry.html


--
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