I'm having the following difficulty, getting a value through my form:
Double salario = Double.parseDouble(request.getParameter("salario"));
Since the value entered by the user will be something like: 2.687,35 . And this value, I will compare with some other%% variables as well.
However, double
this method expects the data to be in the American format and without thousands separators.
So I used Double.parseDouble
as follows:
String salario = request.getParameter("salario");
NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("pt","BR"));
Double s = nf.parse(salario).doubleValue();
On line:
Double s = nf.parse(salario).doubleValue();
Give the following error:
unreported exception exception must be caught or declared to be thrown
I have tried to put it inside NumberFormat
and it continues with the same message.