Hi,
We have a Form that accepts many fields for user to Input.
Here is the problem...
Example: Assume 2 fields qty (for getting quantity from the user) and unitprice ( accepts
unit price from the user).
Inside the
servlet...
String unitprice = req.getParameter("unitprice");
double unitprc = Double.valueOf(unitprice).doubleValue();
String qty = req.getParameter("qty");
int quantity = Integer.parseInt(qty);
double total=0.00
total = quantity * unitprc;
When this total field is printed, it gives the output with single precision (decimal) like 25.0 etc.
Here is an example: If qty=5 and unitprice=4.0 or 4.00 or 4
the total reflects only 20.0
Actaully, the output is expected to be something like 20.00 (i.e with 2 decimal places)
Any help is appreciated.
Thanks,
Suresh Selvaraj