空指针异常

来源:1-11 Servlet获取表单数据

空指针异常null

2016-11-17 19:56

和老师代码一样,为什么会报空指针异常。完全按照老师的步骤来的,一个字一个字的打

写回答 关注

5回答

  • 韶关hotel
    2016-11-17 23:35:39

    在servlet类中格式化birthday的时候有没有中文呀?不然我也不知道呢;没代码/流泪

    空指针异常n... 回复黑山头山大王

    哈哈哈哈,我也被自己坑到了。

    2016-11-28 16:35:00

    共 3 条回复 >

  • 韶关hotel
    2016-11-17 21:27:46

    http://img.mukewang.com/582db03000011d3b02300175.jpg你js Floder添加有没有错误先?

    空指针异常n...

    js的路径吗?我是放在webroot文件夹下的js文件夹下面的

    2016-11-17 21:30:32

    共 1 条回复 >

  • 黑山头山大王
    2016-11-17 21:22:33

    at servlet.RegServlet.doPost(RegServlet.java:111)

    看一下这一行的代码

    空指针异常n... 回复黑山头山大王

    唉,最后的问题是regServlet中保存到session时的键一个字母拼错了。。。所以跳转的时候传不过去数据

    2016-11-18 08:32:29

    共 5 条回复 >

  • 空指针异常null
    2016-11-17 20:58:00

    十一月 17, 2016 8:56:50 下午 org.apache.catalina.startup.Catalina start

    信息: Server startup in 4807 ms

    asdf

    asd

    Male

    asdf

    Wed Nov 02 00:00:00 CST 2016

    十一月 17, 2016 8:57:19 下午 org.apache.catalina.core.ApplicationDispatcher invoke

    严重: Servlet.service() for servlet jsp threw exception

    java.lang.NullPointerException

    at java.util.Calendar.setTime(Calendar.java:1106)

    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:955)

    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:948)

    at java.text.DateFormat.format(DateFormat.java:336)

    at org.apache.jsp.userinfo_jsp._jspService(userinfo_jsp.java:168)

    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)

    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)

    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)

    at servlet.RegServlet.doPost(RegServlet.java:111)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)

    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:745)

    org.apache.jasper.JasperException: java.lang.NullPointerException

    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:561)

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)

    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)

    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)

    at servlet.RegServlet.doPost(RegServlet.java:111)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)

    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:745)

    Caused by: java.lang.NullPointerException

    at java.util.Calendar.setTime(Calendar.java:1106)

    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:955)

    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:948)

    at java.text.DateFormat.format(DateFormat.java:336)

    at org.apache.jsp.userinfo_jsp._jspService(userinfo_jsp.java:168)

    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)

    ... 36 more


    空指针异常n... 回复黑山头山大王

    不行,还是有问题。我明天重做一遍试试吧。好坑爹啊。。。。

    2016-11-17 21:29:31

    共 4 条回复 >

  • 黑山头山大王
    2016-11-17 20:32:53

    可能是获取日期那里为空,那是个JS控件,webContent下面有一个js的文件夹

    把报错信息贴上来看看

    空指针异常n... 回复黑山头山大王

    稍等一下

    2016-11-17 20:56:31

    共 5 条回复 >

JAVA遇见HTML——Servlet篇

本门课程在JSP课程的基础上,深入介绍Servlet的基础知识

160613 学习 · 1029 问题

查看课程

相似问题