Dear experts,
There have been several requests for changing the coercion rules in EL,
when the sources is a null or an empty string. See
http://java.net/jira/browse/JSP_SPEC_PUBLIC-184
http://java.net/jira/browse/UEL-12
http://java.net/jira/browse/UEL-13
I think we should address this issue in EL 3.0.
Specifically, we should make the distinction between a target type of
say int vs. Integer. A null should be coerced to a 0 in the formal
case, and remains a null in the later.
Similarly, if the target is a String, a null should not be coerced to
"", but should remains a null.
This would break backward compatibility, but nobody seems to want the
current behavior, and this is really a bug.
We have also introduced custom pluggable type converter in EL 3.0. The
currently proposal adds a new field in the ELContext. Though it would
work, I am leaning more to adding a new method in the ELResolver, such as
Object converType(Object obj, Class<?> targetType);
The reason for putting it in the ELResolver is that it allows for
addition of multiple ELResolvers to handle multiple custom type
converters, and that ELResolver seems to be a more suitable home for it.
If there are comments or questions, please let me know.
Kin-man