| Author |
Problem using convertNumber for decimal numbers
|
camilla bat
Greenhorn
Joined: Jul 29, 2005
Posts: 14
|
|
I'm using a f:convertNumber on an inputText. I want the number that is typed to convert to a Double (or double). This is my inputText: <f:inputText value="#{myBean.length}" > <f:convertNumber pattern="####0.0"/> </af:inputText> The format of the input is supposed to be maximal 5 digits, and one decimal. If the user types e.g. 4, I want the converter to convert this to a Double 4.0. But it takes it as a Long, so I get a classCastException. Is it possible at all to use this converter for my purpose: convert to a one decimal number. The pattern is maybe wrong?
|
 |
Rajeev Ravindran
Ranch Hand
Joined: Aug 27, 2002
Posts: 455
|
|
i never tried pattern but i think this will server your purpose <f:convertNumber maxFractionDigits="1" minFractionDigits="1" maxIntegerDigits="5" groupingUsed="false"/> I hope you have defined 'length' as double in your managedbean. Thanks,
|
 |
 |
|
|
subject: Problem using convertNumber for decimal numbers
|
|
|