aspose file tools*
The moose likes JSP and the fly likes null values in EL doubt. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "null values in EL doubt." Watch "null values in EL doubt." New topic
Author

null values in EL doubt.

Kunal Shridhar
Greenhorn

Joined: Jun 12, 2011
Posts: 1

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

Joined: May 26, 2003
Posts: 30929
    
158

In SQL, nothing is equal to null. I'm guessing it is similar in EL. False is an object so it isn't null.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: null values in EL doubt.