The example at
http://jakarta.apache.org/velocity/user-guide.html#Conditionals
#elseif( $bar = 6 )
seems to be incorrect. For a proper numeric comparison, it should be '=='
not '='. At
least this is what we figured our at the end of a long day. Also, the
following documentation
regarding the '==' as the identity misled us since it is not the case when
you compare
numeric values (which are represented by Integer instances) which means that
($foo == 5) is
different from ($foo == $bar) even if $bar is set to 5. Am I missing
somthing ?
This raises again the issue of handling errors in the template.
Velocity seems to be very casual about errors (or at least
'misunderstandings') in the template
which makes it difficult to debug or test new templates. The other case we
encountered was
when we the number we used in the comparison was a Long rather than an
Integer. Between these
two cases, we (that is, I) spent significant time to figure out what is
going wrong and had to resort
to consulting the source code.
Is there any way to make velocity more helpful in similar situations ? If it
already spits
errors or warning to a log file, is it possibly to make them more visible ?
If it ignore these
cases, is it possible to make it more strict (even a runtime flag that sets
the levels or
errors/warning reporting).
BTW, we are using it from an application, not as a servlet.
Thanks for a great product,
Tal