在表單提交了,就會彈出這樣一些東西,說是空指針異常,但具體是哪裡我並不知道,煩請大神們幫我看看。
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.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.NullPointerException
org.apache.jsp.checked_jsp._jspService(checked_jsp.java:127)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
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/8.0.28 logs.
表單處理頁面代碼及表單代碼:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
}
%>
<font size="4" color="blue">您的注冊信息是</font><br>
用戶名:<%=name%><br>
密碼:<%=password %><br>
確認密碼:<%=repassword %><br>
性別:<%=sex %><br>
職業:<%=work %><br>
愛好:<%=strLove %><br>
個人說明:<%=show %><br>
<!DOCTYPE html>
首先職業的option裡必須要value屬性,要不然沒法取值
其次你的love是沒有值的,因為沒有name為love的組件,
應該是這樣的
<td align="left">
<input type="checkbox" name="love" value="love1" />電腦網絡
<input type="checkbox" name="love" value="love2" />影視娛樂
<input type="checkbox" name="love" value="love3" />棋牌娛樂
<br/>
<input type="checkbox" name="love" value="love4" />讀書讀報
<input type="checkbox" name="love" value="love5" />美酒佳肴
<input type="checkbox" name="love" value="love6" />繪畫書法
</td>