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
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
org.apache.jsp.register.register_jsp._jspService(register_jsp.java:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
什么意思哦。。。
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
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
org.apache.jsp.register.register_jsp._jspService(register_jsp.java:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
什么意思哦。。。
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 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException org.apache.jsp.register.register_jsp._jspService(register_jsp.java:71) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
----------------解决方案--------------------------------------------------------
写着空指针异常呢啊
----------------解决方案--------------------------------------------------------
知道啊 但是不知道去哪找哎。。。
----------------解决方案--------------------------------------------------------
你自己都找不到 别人怎么能找到呢
----------------解决方案--------------------------------------------------------
不是啊 这个上面的提示好像都不是我的程序里的啊。。
要不我帖上我的代码 版主帮我看下喽
----------------解决方案--------------------------------------------------------
[CODE]
DBConnect代码:
package com.simon.db;
import java.sql.*;
import java.util.*;
public class DBConnect {
public DBConnect() {
}
public static Connection getConnection() {
ResourceBundle rb = ResourceBundle.getBundle("db");
try {
String driverName = rb.getString("db.driver");
Driver dirver = (Driver)Class.forName(driverName).newInstance();
String url = rb.getString("db.url");
Connection con = DriverManager.getConnection(url);
return con;
} catch(ClassNotFoundException cnfExc) {
System.out.println(cnfExc.getMessage());
cnfExc.printStackTrace();
} catch(SQLException sqlExc) {
System.out.println(sqlExc.getMessage());
sqlExc.printStackTrace();
} catch(IllegalAccessException e) {
System.out.println(e.getMessage());
e.printStackTrace();
} catch(Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
return null;
}
public static void main(String[] args) throws Throwable{
//Connection con = getConnection();
//Statement stmt = con.createStatement();
}
}
----------------解决方案--------------------------------------------------------
应该是你的程序有问题 向数据库插入数据常常出现空指针异常
仔细检查 就可以了
(我可不是这个版的斑竹)
----------------解决方案--------------------------------------------------------
[CODE]
register2.jsp代码:
<%@ page language="java" import="java.sql.*" pageEncoding="gb2312" errorPage=""%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<base href="http://localhost:8080/JSPExercise/">
<title>My JSP 'regist2.jsp' page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body background="../PIC/bg2.jpg">
<form name = "register" action = "register/register.jsp" method = "post">
<TABLE cellSpacing="0" cellPadding="0" width="610" align="center" border="0">
<tr>
<td width="610" height="50"><font size="4" color="#2d5bbb"> 注册步骤:
1.阅读使用手册 -> <font color=red>2.选择用户名,填写个人资料 </font>-> 3.注册成功</font></table>
<tr>
<TABLE cellSpacing="0" cellPadding="0" width="492" align="center" border="0">
<tr>
<td width="86" height="42"> 用户名:
<td width="406"><input type = "text" name = "name" size = "20"><font color="red">*(你在班级的真实姓名)</font>
<tr>
<td width="86" height="42">密码:
<td><input type = "password" name = "password" size = "20"><font color="red">*(你的学号)</font>
<tr>
<td width="86" height="42">确认密码:
<td><input type = "password" name = "checkpassword" size = "20"><font color="red">*</font>
<tr>
<td height="20">性别
<td>男 <input type = "radio" name = "sex" checked="checked">
女 <input type = "radio" name = "sex"><font color="red">*</font>
<tr>
</table>
<br><table width="495" height="130" align = "center">
<tr>联系方式:<br><br>
<td width="492">
<p>1:手机号码: <input type = "text" name = "mobelphone" size = "20"><br><br>
2:QQ号码: <input type = "text" name = "QICQ" size = "20"><br><br>
3:邮箱: <input type = "text" name = "E-mail" size = "20"><br><br>
4:详细住址:
<input type = "text" name = "province" size = "10">省
<input type = "text" name="city" size="10">市
<input type = "text" name = "street" size = "20"><br>
<p align = "center"><font color = "#2d5bbb">带*号的必填,联系方式好歹给个面子填上一个吧!</font></p>
</table>
<p align = "center"><input type = "image" src = "PIC/commit2.gif">
</form>
</body>
</html>
----------------解决方案--------------------------------------------------------
[CODE]register.jsp代码:
<%@ page language="java" import="com.simon.db.*,java.sql.*,java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
String name = request.getParameter("name");
String ID = request.getParameter("password");
String checkID = request.getParameter("checkpassword");
String sex = request.getParameter("sex");
String mobelphone = request.getParameter("mobelphone");
String qq = request.getParameter("QICQ");
String Email = request.getParameter("E-mail");
String province = request.getParameter("province");
String city = request.getParameter("city");
String SQLCommand = "insert into Student_info values('"
+ ID + "', " + 1 + ", '" + province + "', '" + city + "', "
+ null + "', '" + mobelphone + "', '" + qq + "', '" + Email +"');";
%>
<%
Connection con = DBConnect.getConnection();
Statement stmt = con.createStatement();
stmt.execute(SQLCommand);
con.close();
response.sendRedirect("register/registersuccess.jsp");
%>
[/CODE]
----------------解决方案--------------------------------------------------------
一般空指针出现肯定是没对象你就在用,你看你页面表现的时候的一些操作,是否有值
----------------解决方案--------------------------------------------------------