Hello everybody,
I have the following problem with conversion of an inputfield to a
BigDecimal. The input has to distinguish between zero and empty string.
The page contains the following code:
<h:inputText value="#{sessionBean.testvar}">
<f:convertNumber type="number" />
</h:inputText>
sessionBean.testvar ist a simple BigDecimal with default getter and
Setter.
Submitting the page with a empty field sets testvar to an BigDecimal with
value 0 and rerendering of the page brings up a "0" in the inputfield
instead of leafing it empty.
Google and our analyse of the problem pointed the following:
We use this environment: Tomcat 6.0.32, MyFaces 1.2.10
I found Tomcat runtime parameter
-Dorg.apache.el.parser.COERCE_TO_ZERO="false" as a workaround.
https://issues.apache.org/bugzilla/show_bug.cgi?id=43285#c7
http://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html
I don't want to use this workaround on our servers. (Not sure of
side-effects on other apss)
What is the right solution to prevent this behaviour? Did I get sonething
wrong?
Is there a better solution (in MyFaces I would prefer ;-) )?
Best regards
Jürgen Wieners