I tried with my-faces-1.1.1 and the daily build from 11/07 and both of
them don't work.
They return Double or Long depending on the entered number.
If the backing bean object (amountWithVat) is of type Double:
Enter 4,784 or 598 =>
17188 [TP-Processor7] ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/montecristo]
- Cannot set value for expression '#{OrderCreation.amountWithVat}' to a
new value of type java.lang.Long
javax.faces.el.EvaluationException: Cannot set value for expression
'#{OrderCreation.amountWithVat}' to a new value of type java.lang.Long
at
org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:304)
at javax.faces.component.UIInput.updateModel(UIInput.java:226)
at javax.faces.component.UIInput.processUpdates(UIInput.java:165)
at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:428)
enter 478.4 => Ok
enter 4,789.39=> Ok
If the backing bean object is of type Long:
enter 4,784 or 598 => Ok
enter 478.4 or 4,789.39 =>
44306 [TP-Processor5] ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[l
ocalhost].[/montecristo] - Cannot set value for expression
'#{OrderCreation.amo
untWithVat}' to a new value of type java.lang.Double
javax.faces.el.EvaluationException: Cannot set value for expression
'#{OrderCrea
tion.amountWithVat}' to a new value of type java.lang.Double
at
org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java
:304)
at javax.faces.component.UIInput.updateModel(UIInput.java:226)
at javax.faces.component.UIInput.processUpdates(UIInput.java:165)
at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.
java:428)
Dave wrote:
JSF should use BigDecimal. One type for all different numbers.
*/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...
Has anyone found a way to force the type of the returned value?
Thanks,
Yannick
------------------------------------------------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
<http://us.lrd.yahoo.com/_ylc=X3oDMTFqODRtdXQ4BF9TAzMyOTc1MDIEX3MDOTY2ODgxNjkEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw--/SIG=110oav78o/**http%3a//farechase.yahoo.com/>