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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…