The problem is independent of the used pattern. I removed the pattern and got the same error message. The NumberConverter.getAsObject returns null if the value is null or if value.length() is 0.
I think the problem is that JSF does not find an appropriate setter for setting null! I am also not sure whether the NumberConverter has to return null or 0 in this case, which is the default for primitive numeric values. Any ideas ? -----Original Message----- From: Mike Kienenberger [mailto:[EMAIL PROTECTED] Sent: Dienstag, 11. September 2007 22:52 To: MyFaces Discussion Subject: Re: number conversion and null values Maybe <f:convertNumber pattern="###.##"/> instead? I'm not an expert on format patterns, but doesn't 0 mean "at least one digit?" On 9/11/07, Michael Heinen <[EMAIL PROTECTED]> wrote: > > > > > I have a conversion problem with doubles and null values. > > > > JSP snippet: > > <h:inputText > > value="#{!empty MyController.category&& MyController.category.treshold>=0? > MyController.category.treshold:''}"> > > <f:convertNumber pattern="##0.##"/> > > </h:inputText> > > > > Class Category > > public double getTreshold() > > { > > return this.mTreshold; > > } > > public void setTreshold(double treshold) > > { > > this.mTreshold = treshold; > > } > > > > This is working fine if I enter valid doubles. > > The following message is displayed if I enter nothing in the input field: > > > > Exception setting property Threshold: of base with class > com.recommind.litigation.client.web.model.Category, Bean: > com.recommind.litigation.client.web.model.Category, > property: Threshold:, newValue: null ,newValue class: null method parameter > class: double, null > > > > The getAsObject method of the NumberConverter returns null as expected. > > > > What should I do now with the treshold property of the Category class ? > > I tried without success: > > - setTreshold(Double treshold) > > - setTreshold(Number treshold) > > > > A workaround is to set the value to 0 via javascript but this is not a good > alternative. > > > > Michael

