String initial_price = request.getParameter("initial_price");
float initial_price_float = 0;
try {
initial_price_float = Float.parseFloat(initial_price);
} catch (NumberFormatException e) {
session.setAttribute("message", "Wrong input");
}
上面写的代码给了我这个错误,但我很确定我写的数字是正确的。我该如何解决?
java.lang.NullPointerException
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1008)
java.lang.Float.parseFloat(Float.java:452)
servlet.AddProduct.doPost(AddProduct.java:114)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)