在表单提交了,就会弹出这样一些东西,说是空指针异常,但具体是哪里我并不知道,烦请大神们帮我看看。
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">
验证页面
<%
String name = (String) request.getParameter("usernaem");
String password = (String) request.getParameter("password");
String repassword = (String) request.getParameter("repassword");
String sex = (String) request.getParameter("sex");
String work = (String) request.getParameter("work");
String[] love = (String[]) request.getParameterValues("love");
String show = (String) request.getParameter("show");
String strLove = "";
for (int i = 0; i < love.length; i++) {
if(strLove.trim().equals("")){
strLove = strLove + "'" + love[i].toString() + "'";
}else{
strLove=strLove+","+love[i].toString()+"'";
}
}
if(strLove.trim().substring(0,strLove.trim().length()).equals(",")){
strLove=strLove.trim().substring(0,strLove.trim().length()-1);
}
%>
<font size="4" color="blue">您的注册信息是</font><br>
用户名:<%=name%><br>
密码:<%=password %><br>
确认密码:<%=repassword %><br>
性别:<%=sex %><br>
职业:<%=work %><br>
爱好:<%=strLove %><br>
个人说明:<%=show %><br>
<!DOCTYPE html>
用户注册
<!--center标签的作用是使在它之内写的信息全部居中显示 -->
用户名: |
<!-- 输入文本框 --> |
密码: | |
确认密码: | |
性别: | checked />男 女 |
职业: |
学生 职员 经理 军人 自由人 |
个人爱好: |
电脑网络 影视娱乐 棋牌娱乐 读书读报 美酒佳肴 绘画书法 |
个人说明: |
|
|
|