HTTP Status 500 - null

问题描述

新手!!!!!要被这个问题弄疯了~~~~~报错内容java.lang.NumberFormatException:nulljava.lang.Integer.parseInt(Integer.java:454)java.lang.Integer.parseInt(Integer.java:527)servlet.AddPerson.doPost(AddPerson.java:38)javax.servlet.http.HttpServlet.service(HttpServlet.java:641)javax.servlet.http.HttpServlet.service(HttpServlet.java:722)源代码publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{response.setContentType("text/html");request.setCharacterEncoding("gb2312");response.setCharacterEncoding("gb2312");PrintWriterout=response.getWriter();Stringpname=request.getParameter("pname");Stringtypeid=request.getParameter("tname");inttid=Integer.parseInt(typeid);Stringsex=request.getParameter("sex");Stringbirthday=request.getParameter("birthday");Stringqq=request.getParameter("qq");Stringphone=request.getParameter("phone");Stringemail=request.getParameter("email");Stringaddress=request.getParameter("address");Stringremark=request.getParameter("remark");Personperson=newPerson();person.setPname(pname);person.setTid(tid);person.setSex(sex);person.setBirthday(birthday);person.setQq(qq);person.setPhone(phone);person.setEmail(email);person.setAddress(address);person.setRemark(remark);PersonDaopd=newPersonDao();inti=pd.addPerson(person);if(i==0){out.print("<script>location.href='../index.jsp';alert('娣诲);</script>");}else{out.print("<script>location.href='../index.jsp';alert('娣"+pname+"銆戞垚鍔燂紒');</script>");}out.flush();out.close();}publicvoidinit()throwsServletException{}}就第三个报错我看懂了是这边的问题,但是还是不知道怎么改,其他的都看不懂啊!!!!!!!!!!

解决方案

解决方案二:
这明显是你把null强转int导致的。
解决方案三:
有个int类型的属性在页面没获取到值吧,是不是那个tid阿?然后在你set的时候报的错吧。
解决方案四:
typeid这个值为null也就是说:Stringtypeid=request.getParameter("tname");为null可能是你参数名字搞错了。我估计你是不是应该写为:Stringtypeid=request.getParameter("typeid");的。
解决方案五:
lz你好,3楼说的应该可以解决你的问题吧。建议你debug一下或者在Stringtypeid=request.getParameter("tname");后面输出typeid。你会发现typeid为null。错误原因一点是楼上所说Stringtypeid=request.getParameter("typeid")是不是你的key值写错了原因二在页面中你就是付了null值进来。请检查,希望能帮到你。

时间: 2024-11-10 15:12:53

HTTP Status 500 - null的相关文章

javaweb-HTTP Status 500 - Unable to load class for JSP

问题描述 HTTP Status 500 - Unable to load class for JSP <%@ page contentType="text/html pageEncoding="GBK"%> <%@ page import="java.io.*"%> <%@ page import="java.util.*"%> <%@ page import="java.math.

s2sh-报错:HTTP Status 500 -怎么解决

问题描述 报错:HTTP Status 500 -怎么解决 java.lang.NullPointerException com.hbue.edu.actions.LoginAction.execute(LoginAction.java:38) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp

http-tomcat一直出这个问题HTTP Status 500

问题描述 tomcat一直出这个问题HTTP Status 500 HTTP Status 500 - java.lang.NullPointerException type Exception report message java.lang.NullPointerException description The server encountered an internal error that prevented it from fulfilling this request. excep

status-系统网页出现这报错:HTTP Status 500,是访问JSP页面哪个地方出错了或者别的?

问题描述 系统网页出现这报错:HTTP Status 500,是访问JSP页面哪个地方出错了或者别的? HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: j

servlet-HTTP Status 500 - Servlet.init()

问题描述 HTTP Status 500 - Servlet.init() HTTP Status 500 - Servlet.init() for servlet springmvc threw exception type Exception report message Servlet.init() for servlet springmvc threw exception description The server encountered an internal error that

测试-HTTP Status 500 - For input string: &amp;amp;quot;3.0&amp;amp;quot;

问题描述 HTTP Status 500 - For input string: "3.0" 我在做一个增加数据功能的网页,测试时出现了错误提示如下(输入整型数据时不报错,但是输入浮点型数据时却报错): java.lang.NumberFormatException: For input string: "2.0" java.lang.NumberFormatException.forInputString(Unknown Source) java.lang.Int

tomcat-Tomcat部署HTTP Status 500

问题描述 Tomcat部署HTTP Status 500 解决方案 http://q.cnblogs.com/q/24097/ 解决方案二: http://elva1087penny.blog.163.com/blog/static/100456917201304113944244/ 解决方案三: tomcat7 HTTP Status 500 - java.lang.ClassCastExceptionTomcat 5.5.26 Administration Tool HTTP Status

http-HTTP Status 500 一直报错

问题描述 HTTP Status 500 一直报错 HTTP Status 500 - javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/struts/util/MessageResources type Exception report message javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apac

Tomcat报错:HTTP Status 500 (Wrapper cannot find servlet class)解决办法_java

Tomcat报错:HTTP Status 500 - Wrapper cannot find servlet class HTTP Status 500 - Wrapper cannot find servlet class com.servlet.servlet.RegServlet or a class it depends on type Exception report message Wrapper cannot find servlet class com.servlet.servl