| Author |
How to read a False Value
|
Steve Dyke
Ranch Hand
Joined: Nov 16, 2004
Posts: 1254
|
|
When rf1 = true and rf2 = false I still get the else condition result. What is the syntax for interpreting a false value?
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Are you sure you have a false Boolean and not some other value that is really true? How are your Booleans being declared? Eric
|
 |
Varun Chopra
Ranch Hand
Joined: Jul 10, 2008
Posts: 204
|
|
Make sure rf1 = true and rf2 = false, then code will certainly go in if. See below:
Output: in if
|
-Varun -
(My Blog) - Mock Tests
|
 |
Steve Dyke
Ranch Hand
Joined: Nov 16, 2004
Posts: 1254
|
|
In my servlet I have: Then in my JSP I have:
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Do yourself a favor and do Eric
|
 |
Steve Dyke
Ranch Hand
Joined: Nov 16, 2004
Posts: 1254
|
|
|
Returned a value of string.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Your code: If you put quotes around it, then it's a string. Non-empty strings are truthy. Example: Would show a popup with "true" in it. Try removing the quotes. [ November 20, 2008: Message edited by: Ben Souther ]
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Steve Dyke
Ranch Hand
Joined: Nov 16, 2004
Posts: 1254
|
|
|
Thanks.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Just to add what Ben said... now do JavaScript was doing the right thing treating your string as true. I recommend you to pick up JavaScript: The Good Parts and read it a few times. [It is short and packed with info, he explains this stuff] Eric
|
 |
 |
|
|
subject: How to read a False Value
|
|
|