Reputation: 1237
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>
Upvotes: 6
Views: 4153
Reputation: 4832
NB : The above does not work if the element is placed within <ui:repeat>
, but works if replaced with <c:forEach>
Upvotes: 0
Reputation: 1108682
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.
Upvotes: 7