velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <...@xyris.com>
Subject RE: ArrayList Failure
Date Tue, 13 Feb 2001 17:11:45 GMT
From: Ivan [mailto:ivan@buc.com]

> Christoph's note of Jan 24 says that I can use an array defined in the
> template, but I haven't been successful.
>
> Velocity.jar version: nightly build 20010213
>
> Template snipet:
> #set ($condText = ["Mint", "Better Condition", "Average Condition",
> "Fair", "Poor", "Restorable"])
> ---
> I've tried
> #if ($b.adjusted)Fair Market Price Adjusted for
> $condText.get($query.cond): $b.adjusted<br>#end

What type is the result of $query.cond ?

> and this
>      #set ($i = $query.cond)
>       #if ($b.adjusted)Fair Market Price Adjusted for
> $condText.get($i):
> $b.adjusted<br>#end

That shouldn't help :)

> and this
>    #set ($i = $query.cond)
>       #if ($b.adjusted)Fair Market Price Adjusted for
> $condText.get(i):

This won't work :)

> $b.adjusted<br>#end

> None of the above work ...Log file says that $condText.get(i) or
> $condText.get($i) or $condText.get($query.cond) is not a valid
> reference.

ArrayList.get() takes an int arg.  I thought that primitive unwrapping was
done for you, but I am checking that now.  We need to know what $query.cond
is.

> The following works:
>     #if ($b.adjusted)Fair Market Price Adjusted for $condText.get(2):
> $b.adjusted<br>#end

Which affirms the int arg to get()

> Am I missing something here?
> Ivan Saltz
>
> (P.S. This will be a production system.)

Cool!  We'll solve this!

geir



Mime
View raw message