How to convert String to Decimal?
807603Dec 18 2007 — edited Dec 18 2007I have the following code:
I'm creating a new object from a Struts form fields to use later in business logic to update a database table:
transferObject = new PropertyHolder(wbasForm.getStrFundCode(),wbasForm.getCountyCode(),
wbasForm.getStrFundName(),wbasForm.getStrAgrNum(), new BigDecimal(wbasForm.getPrtRate()), new BigDecimal(wbasForm.getFltRate()), wbasForm.getEffDate(),wbasForm.getStrExpDate());
I have two form fields: prtRate and fltRate
when executing new BigDecimal(wbasForm.getPrtRate()) having 880.00 as a parameter to PropertyHolder class everything works fine and program propagates to the database logic.
But when executing BigDecimal(wbasForm.getFltRate()) having 1540.00 as a parameter to PropertyHolder class,
I'm getting "Unhandled Exception thrown: class java.lang.NumberFormatException For input string: "1,54000"]: java.lang.NumberFormatException
What am I doing wrong?
Thank you
Eugene