How to set -Dorg.apache.el.parser.COERCE_TO_ZERO=false programmatically
You can set the system properties programmatically using System#setProperty()
.
System.setProperty("org.apache.el.parser.COERCE_TO_ZERO", "false");
However, you need to ensure that this is been set before JSF/EL ever get initialized. Best place would be a ServletContextListener
.
public class Config implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent event) {
System.setProperty("org.apache.el.parser.COERCE_TO_ZERO", "false");
}
@Override
public void contextDestroyed(ServletContextEvent event) {
// NOOP
}
}
Register it as <listener>
in web.xml
, or when you're already on Servlet 3.0 (Tomcat 7 and so), with @WebListener
annotation.