Tal Dayan wrote:
>
> 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 ?
>
Nope. Thanks. I fixed the typo, and claified the following text.
> 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.
Did you consult the log? It should have listed something like -
Tue Jul 24 06:27:26 EDT 2001 [error] Error in evaluation of ==
expression. Both arguments must be of the same Class. Currently left =
class java.lang.Long, right = class java.lang.Integer. tal.vm [line 3,
column 16] (ASTEQNode)
This issue, namely numeric comparison, is something I will get to right
after we come to some conclusion about the separate instance version of
vel that is languishing on my local machine :)
>
> 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 ?
To whom? Log messages, which I would argue are rather descriptive, go
to the log file under [error], so you could always grep for that to
avoid reading through all the goop.
> 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).
It's *very* strict right now, and logs as such.
> BTW, we are using it from an application, not as a servlet.
>
Cool. What does it do? (I love hearing about the app uses...)
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
Be well, do good work, and keep in touch.