I have a POJO:
public class Foo {
public String getValue(Integer arg0, BigDecimal arg1) {...}
}
I put it as model-parameter from Spring MVC into JSP, and try to use it:
<c:set var="ans" value="${foo.getValue(null, null)}"/>
But in getValue
method
arg0 = 0
arg1 = 0
instead of expected
arg0 = null
arg1 = null
I tried to run it on Tomcat 7.0.40 and on jetty 9.0.3
Is it some Tomcat bug, or It is right way EL works? How can I call method with null parameters in EL?
Update 1: Several sources, and documentation (http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html) says that adding JVM property
-Dorg.apache.el.parser.COERCE_TO_ZERO=false
solves it.
But when I set it, nothing happen. I've set it correct
System.getProperty("org.apache.el.parser.COERCE_TO_ZERO")`
returns "false"
in runtime)
May be Tomcat need some other settings to change to use this param...
<c:set var="ans" value="${foo.getValue(null, null)}"/>
. While using JSTL you can't call method in that way. You can access attributes instead${foo.value}
and the corresponding getter will be called behind the scenes. Besides, you cannot pass parameters because it is assumed that a getter is parameterless – Babysit