> Servlet NumberFormatException problem

Hi -- Newbie question:

I have class A with the following code in my main method:

System.out.println(Double.parseDouble("19.95"));

This code compiles and runs fine printing out 19.95 to command prompt..

When I copy this exact code into my servlet B's doPost method it compiles fine but when I run the servlet (via browser form submit) the servlet stops executing when it reaches this line. The javawebserver log file says there is a NumberFormatException.

Any ideas why this might be?

Thanks for any help

J

[562 byte] By [j_java] at [2007-9-26 11:32:44]
# 1
I found that I could use Double.valueOf(str).doubleValue(); instead,,:)
j_java at 2007-7-2 1:33:10 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
I think your servlet gets the String "19.95" from the browser instead of the Double you want it to get.So, just transform it:Double.parseDouble(String s)
stelt at 2007-7-2 1:33:10 > top of Java-index,Archived Forums,New To Java Technology Archive...