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
>

Reply via email to