Title: RE: convertNumber returned type?

I don´t know if is the same behavior, but I´m having problems with conversions in 1.1.1

Take a look in that JIRA

http://issues.apache.org/jira/browse/MYFACES-796

Rogerio

-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 08, 2005 12:49 PM
To: MyFaces Discussion
Subject: Re: convertNumber returned type?

It's supposed to work as you'e described.  As Dave says below, use "java.lang.Number" as your data type, and it'll work for both a Long

and a Double.   You can then use Number.doubleValue() no matter which
underlying type was returned.

http://java.sun.com/j2ee/javaserverfaces/1.1/docs/api/javax/faces/convert/NumberConverter.html

"The getAsObject() method parses a String into an java.lang.Double or java.lang.Long...."

On 11/7/05, Yannick Le Teigner <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I use f:convertNumber in my application to display localized number value.
> Problam is that if the number entered in the input box by the user has
> any decimal digits (i.e. 14.75) then the returned number is a Double.
> If the number does not have any decimal digit (i.e 103), then the
> returned number is a Long.
> The only solution I have found is to put MyBean.value as an object of
> type Object, but I have to do type cast all over the place...
>
> <h:inputText value="#{MyBean.value}">
>   <f:convertNumber type="number" maxFractionDigits="2"/>
> </h:inputText>
>
> Has anyone found a way to force the type of the returned value?
>
> Thanks,
> Yannick
>



"Essa  mensagem é  destinada  exclusivamente ao seu destinatário e pode
conter informações confidenciais, protegidas por sigilo profissional ou
cuja  divulgação  seja  proibida por  lei. O uso não autorizado de tais
informações  é   proibido  e  está   sujeito  às  penalidades cabíveis.

This message is intended exclusively for its addressee and may  contain
information that  is  confidential  and  protected  by  a  professional
privilege or whose disclosure is prohibited by law. Unauthorized use of
such  information is  prohibited and subject to  applicable penalties."

Reply via email to