I am using tomcat 7 on CentOS 7 and I need to pass a null value to tag
attributes of type Long/Integer/Float, however it is *always* coerced to
zero.

<%@attribute name="parentId" required="true" rtexprvalue="true"
type="java.lang.Long" %>

Changing required to false does nothing. I tried setting the system
property org.apache.el.parser.COERCE_TO_ZERO to false in tomcat.conf
(-Dorg.apache.el.parser.COERCE_TO_ZERO=false with my other JAVA_OPTS) but
this does nothing. The value before it hits the tag is null and inside the
tag is 0. If I query the System properties it shows it as set to false, but
Tomcat is not honoring it and is still coercing nulls to zero. I understand
the spec says to do this etc but that defeats the purpose of using an
object vs atomic type in the first place and is horribly shortsighted.

Upgrading to Tomcat 8 is not a solution unfortunately as there is no RPM
for it.

How do I pass a null Long/Float/Integer as a tag attribute and have it kept
as null and not turned into an incorrect value?

Chris

Reply via email to