• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null values in EL doubt.

 
Kunal Shridhar
Greenhorn
Posts: 1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In EL, a null value is treated as 0 or false. But why does the statement
${false == null}
output false?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34974
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In SQL, nothing is equal to null. I'm guessing it is similar in EL. False is an object so it isn't null.
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get your base assumption: "In EL, a null value is treated as 0 or false."?
Is that a valid assumption? In all cases?

> why does the statement ${false == null} output false?

Because thats what the spec says it should do.

1.8.2 A {==,!=,eq,ne} B
■ If A==B, apply operator
■ If A is null or B is null return false for == or eq, true for != or ne.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic