2 tailazhiren tailazhiren 于 2016.04.13 02:02 提问

HTTP Status 500 - For input string: "3.0"

我在做一个增加数据功能的网页,测试时出现了错误提示如下(输入整型数据时不报错,但是输入浮点型数据时却报错):
java.lang.NumberFormatException: For input string: "2.0"
java.lang.NumberFormatException.forInputString(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
example4.Insert.doPost(Insert.java:31)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.68 logs.
相关代码如下:
view界面代码:












X:
Y:


javabean代码:
//获取前台页面数据
String x3 =request.getParameter("x");

    double x = Double.parseDouble(x3); 

    String y1 =request.getParameter("y");

    double y = Double.parseDouble(y1); 

    我是新手,请各位大神帮我诊断一下,感激不尽!

2个回答

CSDNXIAOS
CSDNXIAOS   2016.04.13 02:12

type Exception report
message For input string: " 1"
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.NumberFormatException:......
答案就在这里:HTTP Status 500 - For input string: " 1"
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?

devmiao
devmiao   Ds   Rxr 2016.04.13 02:51
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!