2 Replies Latest reply on Oct 20, 2009 5:01 PM by Lukasz Kidala

    convertnumber  argument type mismatch

    Sascha Janz Master
      i got a simple page with an inputtext and a convertnumber. but i only could bind it to a property of primitve type double, if i use Double i got  "argument type mismatch"

      i use Sun's JSF 1.2_12  and Seam 2.0.2 SP1

      my page is

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <ui:composition  xmlns="http://www.w3.org/1999/xhtml"


      <rich:messages id="messages"  />
      <h:inputText value="#{TestBean.d1}"  >
         <f:convertNumber maxFractionDigits="3" minFractionDigits="2" minIntegerDigits="1" maxIntegerDigits="15"
      <h:commandButton value="Submit" ></h:commandButton>

      bean code is

      public class TestBean {
           boolean disabled= false;
           public boolean isDisabled() {
                System.out.println("isdisabled=" + disabled);
                return disabled;

           public void setDisabled(boolean disabled) {
                this.disabled = disabled;

           public void switchdis(){
                disabled =!disabled;
           Double d1;
           public Double getD1() {
                return d1;

           public void setD1(Double d1) {
                this.d1 = d1;

           double d2;
           public double getD2() {
                return d2;

           public void setD2(double d2) {
                this.d2 = d2;



      i must use Double because i must allow using null values
        • 1. Re: convertnumber  argument type mismatch
          Sascha Janz Master
          finally...after struggling for days i got the answer...

          it's nothing about seam

          it's only jsf

          1. According to JSF specification, if you use f:convertNumber, the type of the result depends on the input: if the user enters 0 you will get a Long, if he enters 0.1 you'll get a Double, no matter what you have on your bean. So the correct way to work with f:convertNumber (no matter what other attributes you use, like pattern, or so) is to use a Number on the backing bean, not Integer, or int, or float, or Float, or Double or anything like that.
          2. If you use f:convert id="javax.faces.Double" or the converter attribute in the input controls you will always get a Double, but then you cannot specify any formatting.

          so usinger Number solved my problem
          • 2. Re: convertnumber  argument type mismatch
            Lukasz Kidala Newbie

            Thank you Sasha for your investigation!!

            I had the same problem and your post helped me!!

            Thanks a lot!!