You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2011/06/07 23:17:09 UTC

Re: #foreach($i in [1..$n]) causes exception

Robert,

On 5/30/2011 4:00 PM, Robert Lee wrote:
> I have tried
> #foreach($i in [1..$n])
> Where $n is set into the context as
> 
> context.put("$n", rs.getString("n"));
> 
> oops.  I should have caught it myself.
> 
> context.put("$n", rs.getInt("n"));  did the trick

You might want to remove the leading "$" in the name of the variable,
too. The $ identifies it as a variable, it's not actually part of the
identifier.

-chris