Stephan Coboos wrote:
Hello,
I have a form binding definition like this:
<fb:value id="number" path="number"> <fd:convertor datatype="decimal"/> </fb:value>
And a bean with the corresponding getter and setter methods:
public void setNumber(BigDecimal number)... public BigDecimal getNumber()...
the specific conversion in binding is typically only needed when you bind to a string-only backend (ie when using xml over beans)
it works between the form-datatype en assumed strings on the backend.
above thus assumes fd:datatype of 'decimal' in combination with get/set string
But when I tried to save my form into the bean I got an conversion exception:
"org.apache.commons.jxpath.JXPathException: Exception trying to create xpath number; Cannot modify property: foo.bar.model.Position.number; Cannot convert value of class java.lang.String to type class java.math.BigDecimal; Cannot convert class java.lang.String to class java.math.BigDecimal"
The value of the form for the field "number" is just an integer value like "3". What can I do, to convert the values from String to BigDecimal corectly? I haven't found any solution.
IIUC you should remove the convertor from the binding, and define your fd: type as being decimal
or, if it really is integers, keep the long datatype in your form-definition, and switch the types of your property (getter/setter) on the bean
Thank you.
HTH, -marc= -- Marc Portier http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at http://blogs.cocoondev.org/mpo/ [EMAIL PROTECTED] [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
