Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to convert String to Decimal?

807603Dec 18 2007 — edited Dec 18 2007
I 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2008
Added on Dec 18 2007
3 comments
420 views