java HTTP 状态 500 - 空

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13905048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 14:23:12  来源:igfitidea点击:

HTTP Status 500 - null

javajakarta-eeservletsjdbctomcat7

提问by Tweety

I wrote a java servlet program but when i run it, It was showing the Error HTTP Status 500 - null What it means ; My source code is on this page.

我写了一个 java servlet 程序,但是当我运行它时,它显示错误 HTTP 状态 500 - null 是什么意思;我的源代码在这个页面上

The error was

错误是

HTTP Status 500 - null
type Exception report
message null
description The server encountered an internal error that prevented it from fulfilling this request.
exception
 java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
skypark.Registration.doPost(Registration.java:56)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

Please help me to resolve this....

请帮我解决这个问题......

回答by Jigar Joshi

possibly

可能

int phone=Integer.parseInt(phone1);

phone1is nullpassed

phone1null通过

回答by Nipun Jain

hey correct ur html there is no input type =number just correct as follows

嘿正确你的 html 没有输入类型 = 数字正确如下

Phone Number
</td><td>
<input type="text" name="phone">
</td></tr><tr><td>

回答by Matin Kh

From the error I can say that there is something other than a numberpassed to your function and this exception is raised.

从错误中,我可以说除了number传递给您的函数之外还有其他内容,并且引发了此异常。

Something like this:

像这样的东西:

int a = Integer.ParseInt(aStr);

where the aStris abc

其中,aStrabc

回答by Tweety

You should have attribute name in the input tag.

您应该在输入标签中有属性名称。

<input type="text" name="xyz">

In d servletaccess the value after parsing it, as follows.

在d中servlet访问解析后的值,如下。

int x=Integer.parseInt(request.getParameter("xyz"));