How to receive null value from the view
Good development practices say: “avoid passing null values inside your application”; following this good practice we will be reducing the possibility of the famous NullPointerException. By default the JSF will handle all requests parameters to be not null. An integer will be equals to zero, a Boolean to false and a String will be “” (empty but not null).
If the business rule is to receive null instead some default value, there is a way to notify the JSF to do not provide the default values. The first step is to add the configuration below to the web.xml file.
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
If the application is running in the Glassfish container just the configuration above will complete the task. If the application is running in the Tomcat/JBoss, this configuration alone will not be enough to bring the value as null. This happens because the Tomcat/JBoss will ignore the configuration. To force the container to “respect” the configuration add the following configuration to the container JVM: -Dorg.apache.el.parser.COERCE_TO_ZERO=”false”. The Tomcat/JBoss will keep the empty value as null and will not provide the default JSF values.


Really good material. Thanks very much…
Tugrul, thanks for the support! =D
Thank you very much !!!
You’re welcome [=
This Post is Awesome. Followed every things and applied on my project.
Hello surajtamang,
Thank you for your support.
very usefull material, Keep up the good work
Hello, John
Thanks for the support. [=
Really cool material! I agree with Tim. If this could be distributed in pdf format, you will become a little more famous. :) Thanks, good job!
Hello Thabita, good morning.
I will try to create the PDF, but I will not promise it! =D
Thanks for the support. [=
This is awesome! Could you post the entire article as a PDF for download??
Hello Tim.
I will try, I am really short of time. =/
Thanks for your support. [=