JSF Float Conversion

Posted by Phill Sacre on Stack Overflow See other posts from Stack Overflow or by Phill Sacre
Published on 2010-02-16T14:13:47Z Indexed on 2010/05/29 8:02 UTC
Read the original article Hit count: 308

Filed under:
|
|
|

I'm using JSF 1.2 with IceFaces 1.8 in a project here.

I have a page which is basically a big edit grid for a whole bunch of floating-point number fields. This is implemented with inputText fields on the page pointing at a value object with primitive float types

Now, as a new requirement sees some of the fields be nullable, I wanted to change the value object to use Float objects rather than primitive types. I didn't think I'd need to do anything to the page to accomodate this.

However, when I make the change I get the following error:

/pages/page.xhtml @79,14 value="#{row.targetValue}": java.lang.IllegalArgumentException: argument type mismatch

And

/pages/page.xhtml @79,14 value="#{row.targetValue}": java.lang.IllegalArgumentException: java.lang.ClassCastException@1449aa1

The page looks like this:

<ice:inputText value="#{row.targetValue}" size="4">
  <f:convertNumber pattern="###.#" />
</ice:inputText>

I've also tried adding in <f:convert convertId="javax.faces.Float" /> in there as well but that doesn't seem to work either! Neither does changing the value object types to Double.

I'm sure I'm probably missing something really simple but I've been staring at this for a while now and no answers are immediately obvious!

© Stack Overflow or respective owner

Related posts about exception

Related posts about jsf