myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Walter Mourão <walter.mou...@gmail.com>
Subject Re: Problem with inputText conversion to BigDecimal
Date Fri, 08 Apr 2011 10:41:51 GMT
Hi.

Take a look at
http://myfaces.markmail.org/message/syt73xw5qkmlrcg2?q=COERCE_TO_ZERO

I would suggest you create a String property to receive the value and make
the conversion in its setter (for example), or use Juel (
http://juel.sourceforge.net/ ). The problem in using a different
configuration to change the behavior is your app will not be 100% compliant
with EL...

Good luck,

Walter Mourão
http://waltermourao.com.br
http://arcadian.com.br
http://oriens.com.br



On Fri, Apr 8, 2011 at 6:12 AM, <Juergen.Wieners@hella.com> wrote:

> 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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message