Page 1 of 1
About Question enthuware.jwpv6.2.864 :
Posted: Fri Jan 20, 2012 12:27 am
by goetz
returns false in both GlassFish 3.1 and Tomcat 7. I don't know why...
Re: About Question enthuware.jwpv6.2.864 :
Posted: Sun Oct 14, 2012 4:19 pm
by alex
both
return false in Tomcat 7.0.32
Re: About Question enthuware.jwpv6.2.864 :
Posted: Sun Oct 14, 2012 8:04 pm
by admin
As given in the explanation, the specification is very clear on this. A null is converted to a 0 (Section 1.18.3). So the implementations are not compliant in this case.
HTH,
Paul.
Re: About Question enthuware.jwpv6.2.864 :
Posted: Sat Feb 23, 2013 3:03 pm
by stoyants
Yes, Chapter 1.18.3 of specification states: "If A is null or "", return 0."
But, in case of null, this does not apply, as type conversion should not be executed at all.
Chapter 1.8.1 (about relational operators) states: "If A is null or B is null, return false"
Nevertheless, looks like Tomcat does not implement specification correctly, as in the case of question 2.864 value of requestScope['none'] is empty String and then conversion rule 1.18.3 should apply.
Re: About Question enthuware.jwpv6.2.864 :
Posted: Sat Jul 27, 2013 7:16 am
by JoeAllen
Is ${requestScope['none'] eq 0} the same as ${requestScope[none] eq 0} in this case, since [none] is evaluated to ""?
By the way, have you been able to access coderanch.com these day? I have not. Wonder what happened to it.
Re: About Question enthuware.jwpv6.2.864 :
Posted: Sat Jul 27, 2013 8:26 am
by admin
In case of requestScope['none'], the string "none" is passed as a parameter to requestScope but in case of requestScope[none], you are trying to pass the value of the variable named none, which, in this case, doesn't exist so it evaluates to null. So the end result is same but they are not exactly same.
Please see section 1.6 of EL specification for further details.
HTH,
Paul.