tags:

views:

103

answers:

1

I use:

<h:inputText id="costsPerPallet" value="#{globalReportSelectionForm.palletCost}" size="5">
   <f:convertNumber pattern="0.00"/>
</h:inputText>

palletCost is a Double;

When entering a value of "1.00" and submit it is fine. When I enter "1" and submit I get the error:

java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Double

What is a good way to put "1.00" before the submit. In the onblur javascript function? Or is there a better way?

A: 

Works fine here on JSF Mojarra 1.2_14 and 2.0.2. So I think it's a bug in one of the ancient versions and that you need to upgrade your JSF version. You may also try to explicitly convert it as Double as follows.

<h:inputText converterId="javax.faces.Double">

Not sure if that works though. Upgrading your JSF impl to latest build is definitely worth it.

BalusC
Thanks, I will upgrade JSF.I'm using JBOss, Seam 2.1.2, Richfaces. In the Seam folders I see jsf-api.jar and jsf-impl.jar (Mojarra JSF API Implementation 1.2_12-b01-FCS)But: when deploying I only see jsf-facelets.jar (Implementation-Version: 1.1.15.B1)I created my project using seam-genI will look into how to upgrade it to 1.12For the moment I will leave out: <f:convertNumber pattern="0.00"/>This causes the error.
Guus