velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@alaska.net>
Subject Re: #set $var = (boolean exp) ==> $var = null
Date Wed, 27 Oct 2004 12:56:24 GMT
Shinobu Kawai <shinobu.kawai@gmail.com> wrote:
> Well, here's what you /can/ do using 1.3:
> 
> #set ($listIsEmpty = $list.empty)
> #if ($listIsEmpty)
> no elements!
> #else
> first element : $list.get(0)
> #end
> 
> It looks like it's the expression that Velocity doesn't like, and not
> the Boolean.  (It didn't work for ... = !$list.empty)

Thanks for looking into it.

Fortunately, out of my hundreds of templates, I only used that construct 
once, and it was trivial to place it directly in the #if statement.

I never thought to check $list.empty, but that's a variable assignment, not 
a velocity boolean expression.

Probably the best news is that it's fixed in 1.4.

-Mike

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


Mime
View raw message