This question is similar to:
jsf: integer property binded to a inputtext in UI is set to zero on submit
but I am not completely satisfied with the solution. The contexts is the same: I have a web form requiring an Integer value. If the textbox is left empty, I want my Integer field to be 'null' but instead the EL Parser automatically sets my id field to '0'.
I can fix the problem by setting a JVM Parameter in my local Tomcat VM:
-Dorg.apache.el.parser.COERCE_TO_ZERO=false
However, this will not work for our client's machine. Is it possible to set/change this JVM parameter "in-code".
Update: I've found that this is being requested but if anyone else has any other workaround, I would like to hear that too.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48813
Update 2: I can't change the value back from a '0' to a 'null' because my application should treat '0' as an actual id. So I need to know at runtime whether the id textbox was left empty or not.