You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Jason van Zyl <ja...@zenplex.com> on 2003/06/29 22:41:13 UTC

[Jelly] inconsistency in boolean handling

Howdy,

I have a variable in the context that is a String and has a value of
"true". Using <j:if/> and <j:when/> yield different results.

If ${value} is set to "true" :

<j:if test="${value}"> evaluates to false and the body doesn't run.

while

<j:when test="${value}"> evaluates to true and the body runs.

Before each of these blocks I am echoing the value of ${value} and it
appears to be "true". From the source they they look like they are
evaluated the same yet I am getting different results?

Anyone know of any oddities with boolean evaluation?

-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


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


Re: [Jelly] inconsistency in boolean handling

Posted by Jason van Zyl <ja...@zenplex.com>.
On Sun, 2003-06-29 at 16:41, Jason van Zyl wrote:
> Howdy,
> 
> I have a variable in the context that is a String and has a value of
> "true". Using <j:if/> and <j:when/> yield different results.
> 
> If ${value} is set to "true" :
> 
> <j:if test="${value}"> evaluates to false and the body doesn't run.
> 
> while
> 
> <j:when test="${value}"> evaluates to true and the body runs.
> 
> Before each of these blocks I am echoing the value of ${value} and it
> appears to be "true". From the source they they look like they are
> evaluated the same yet I am getting different results?
> 
> Anyone know of any oddities with boolean evaluation?

This is part of another more subtle error, in my <j:if/> evaluation the
body is indeed run but the body is an ant task where a NPE occurs and it
seems to get completely eaten and everything continues. So it looks like
it doesn't evaluate but does. I'll dig deeper.

-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


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