You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Etienne Loth <et...@hotmail.com> on 2008/11/27 15:31:15 UTC
Question about Velocity Operation
Hi,
I send an email, cause i got a problem with Velocity. I have Velocity 1.4 and i use JDK 1.4 .
When i use this template :
#set( $a = "Velocity" )
$a
$test
$a.length()
$test.length()
#if (1 > 0 )
test simple : ok
#end
#if ($a.length() > 0 )
test complique : ok
#end
#if ($test.length() > 0 )
test complique2 : ok
#end
Where i give the value of "test" with a map and it's "toto".
The result of generation is :
Velocity
toto
8
4
test simple : ok
test complique : ok
Then apparently i success to do $test.length() but i don't success #if ($test.length() > 0 ) and i got this error message :
[ERROR][ VelocityResourceLoader][27/11][15:27:27] Left side
($test.length()) of '>' operation has null value. Operation not
possible.
Do you have any idea about this problem ?
Thanks a lot
Etienne
_________________________________________________________________
Email envoyé avec Windows Live Hotmail. Dites adieux aux spam et virus, passez à Hotmail ! C'est gratuit !
http://www.windowslive.fr/hotmail/default.asp
Re: Question about Velocity Operation
Posted by Nathan Bubna <nb...@gmail.com>.
Your template looks fine, and it works for me with JDK 1.6 and
Velocity 1.6. I haven't tested on the older versions, but i don't see
any reason it wouldn't work on those also. Are you sure you are using
your context in a threadsafe manner? It looks like something removed
$test from the context between the two calls.
On Thu, Nov 27, 2008 at 6:31 AM, Etienne Loth <et...@hotmail.com> wrote:
>
> Hi,
>
>
>
> I send an email, cause i got a problem with Velocity. I have Velocity 1.4 and i use JDK 1.4 .
>
>
>
> When i use this template :
>
>
>
> #set( $a = "Velocity" )
>
> $a
>
> $test
>
> $a.length()
>
> $test.length()
>
> #if (1 > 0 )
>
> test simple : ok
>
> #end
>
> #if ($a.length() > 0 )
>
> test complique : ok
>
> #end
>
> #if ($test.length() > 0 )
>
> test complique2 : ok
>
> #end
>
>
>
> Where i give the value of "test" with a map and it's "toto".
>
>
>
> The result of generation is :
>
>
>
> Velocity
>
> toto
>
> 8
>
> 4
>
> test simple : ok
>
> test complique : ok
>
>
>
> Then apparently i success to do $test.length() but i don't success #if ($test.length() > 0 ) and i got this error message :
>
>
>
> [ERROR][ VelocityResourceLoader][27/11][15:27:27] Left side
> ($test.length()) of '>' operation has null value. Operation not
> possible.
>
>
>
> Do you have any idea about this problem ?
>
>
>
> Thanks a lot
>
>
>
> Etienne
> _________________________________________________________________
> Email envoyé avec Windows Live Hotmail. Dites adieux aux spam et virus, passez à Hotmail ! C'est gratuit !
> http://www.windowslive.fr/hotmail/default.asp
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org