[jsr-314-open] Coercion in the EL

Martin Marinschek mmarinschek at apache.org
Wed Oct 14 16:35:37 EDT 2009


Hi Dan,

fact is that the spec says this:

Coerce A to Boolean

    * If A is null or "", return false
    * Otherwise, if A is a Boolean, return A
    * Otherwise, if A is a String, and Boolean.valueOf(A) does not
throw an exception, return it

so it DOES touch the nulls. I don't know either who came up with this.

regards,

Martin

On 10/14/09, Dan Allen <dan.j.allen at gmail.com> wrote:
> In truth, I'd don't really understand why the EL spec is not allowing the
> null value through. Unless it detects that a primitive value is required by
> the assignment, it has no right trying to interpret a null value as anything
> other than null. In that sense, it has nothing to do with expected types,
> especially when the value is null.
>
> -Dan
>
> On Tue, Oct 13, 2009 at 5:03 PM, Martin Marinschek
> <mmarinschek at apache.org>wrote:
>
>> Hi all,
>>
>> I don't know if we discussed this already, but today the coercion
>> issue in the EL made me loose a few hours again. I've had this before,
>> but seemingly forgot about it - time to follow up on this.
>>
>> The issue in short: collapsed="#{bb.collapsed}"
>>
>> Boolean getCollapsed() {
>> return null;
>> }
>>
>> will lead to a value of "false" for the collapsed attribute if
>> java.lang.Boolean is set as the expected type of the corresponding
>> value-expression, according to the EL spec. Hrmmpf.
>>
>> You can read more in this blog-entry:
>> http://www.irian.at/blog/blogid/unifiedElCoercion/#unifiedElCoercion
>>
>> Are we going to say that for JSF 2.0 Facelets we will never set the
>> expected-type? Or are existing EL implementations not following the
>> spec and this is not a problem in reality (however, at least the one
>> that I use does follow the spec)?
>>
>> regards,
>>
>> Martin
>>
>> --
>>
>> http://www.irian.at
>>
>> Your JSF powerhouse -
>> JSF Consulting, Development and
>> Courses in English and German
>>
>> Professional Support for Apache MyFaces
>>
>
>
>
> --
> Dan Allen
> Senior Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
>
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
> http://www.google.com/profiles/dan.j.allen
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




More information about the jsr-314-open-mirror mailing list