velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "???\(Brian Lee\)" <>
Subject RE: Range operator
Date Wed, 07 Mar 2001 12:32:36 GMT

I set value of $var in doBuildTemplate() method of source like this.

context.put("var", String.valueOf(10));

$var is substituted well outside the #foreach loop, 
but it's not in #foreach statement.

-----Original Message-----
From: []On Behalf Of Geir Magnusson
Sent: Wednesday, March 07, 2001 8:24 PM
Subject: Re: Range operator

À⵿̱ wrote:

> I have a question about range operator.
> This code is working
>     #foreach ($i in [1..10])
>       $i
>     #end
> But, that code is not working
>     #foreach ($i in [1..$var])
>       $i
>     #end
> and I set $var to 10.

The following example works :

#set($var = 10)

#foreach($i in [1..$var])

(I just tried it :)

Take a look at your template again to make sure that all is well - if
you still have a problem, send us your tempalate so we can take a look.


Geir Magnusson Jr.                     
Developing for the web?  See
View raw message