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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29241
    
139

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: 1016
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.
 
Similar Threads
Help me in EL expression question HFSJ Book page 393
how EL handles the null values
EL "" will it be interpreted as zero ?
Problem with HFSJ pg. 410 jsp:forward
Doubt in EL operator