I have a backing bean where filelds are Long , Double , Integer , String When I am not specifying anything in input field it is taking as zero for Long, Integer and Double instead of null. I am using tomcat to deploy my app. Is there any solution? I have tried the following context parameter, but it does not work.
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
Add the following VM argument to Tomcat startup options.
-Dorg.apache.el.parser.COERCE_TO_ZERO=false
You also need to ensure that you've declared faces-config.xml
conform the JSF 2.0 specification.
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<!-- Your config here -->
</faces-config>
Otherwise JSF 2.0 specific settings/features won't be activated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With