善良的各位?????????这是哪门子问题????????小虾米在这谢过了
各位prawn: 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
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.reg2_jsp._jspService(reg2_jsp.java:79)
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.
JSP原文如下:----------------------------------
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* " errorPage= " " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<script language= "javascript ">
function backward()
{
history.back();
}
</script>
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> please check the following form </title>
</head>
<style type= "text/css ">
<!--@import url(css/jsp.css);-->
</style>
<body bgcolor= "#FFFFFF " text= "#006699 ">
<%@ page language= "java " import= "java.sql.* "%>
<jsp:useBean id= "db " scope= "page " class= "opendb.opendb "/>
<%
String uid=request.getParameter( "uid ");
String sql= "select * from custom where uid= ' "+uid+ " ' ";
ResultSet rs = db.executeQuery(sql);
if(rs.next())
{
rs.close();
%>
<p> sorry! the ID your selected has been regestered ,please choose another one </p>
<p> <input type= "button " name= "button2 " value= "back up " onClick= "bakcward() "> </p>
<%}
else
{
rs.close();
String nickname=request.getParameter( "nickname ");
byte[] tmpbyte=nickname.getBytes( "ISO8859_1 ");
nickname=new String(tmpbyte);
String gender=request.getParameter( "gender ");
tmpbyte=gender.getBytes( "ISO8859_1 ");
gender=new String(tmpbyte);
String pwd=request.getParameter( "pwd ");
String realname=request.getParameter( "realname ");
tmpbyte=realname.getBytes( "ISO8859_1 ");
realname=new String(tmpbyte);
String career=request.getParameter( "career ");
tmpbyte=career.getBytes( "ISO8859_1 ");
career=new String(tmpbyte);
String address=request.getParameter( "address ");
tmpbyte=address.getBytes( "ISO8859_1 ");
address=new String(tmpbyte);
String email=request.getParameter( "email ");
String tel=request.getParameter( "tel ");
String year=request.getParameter( "year ");
String month=request.getParameter( "month ");
String day=request.getParameter( "day ");
%>
<form action= "reg3.jsp " method= "post ">
<input type= "hidden " name= "uid " value= " <%=uid%> ">
<input type= "hidden " name= "nickname " value= " <%=nickname%> ">
<input type= "hidden " name= "gender " value= " <%=gender%> ">
<input type= "hidden " name= "pwd " value= " <%=pwd%> ">
<input type= "hidden " name= "realname " value= " <%=realname%> ">
<input type= "hidden " name= "career " value= " <%=career%> ">
<input type= "hidden " name= "address " value= " <%=address%> ">
<input type= "hidden " name= "email " value= " <%=email%> ">
<input type= "hidden " name= "tel " value= " <%=tel%> ">
<input type= "hidden " name= "year " value= " <%=year%> ">
<input type= "hidden " name= "month " value= " <%=month%> ">
<input type= "hidden " name= "day " value= " <%=day%> ">
<div align= "center "> <b> <font size= "3 "> please check up the following information </font> </b>
<hr width= "100% ">
<table width= "414 " border= "0 " cellspacing= "2 " cellpadding= "1 ">
<tbody>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> user ID: </div>
<td align= "left " width= "255 "> <%=uid%> </td>
</td>
</tr>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> your nickname: </div>
<td align= "left " width= "255 "> <%=nickname%> </td>
</td>
</tr>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> your realname: </div>
<td align= "left " width= "255 "> <%=realname%> </td>
</td>
</tr>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> career: </div>
<td align= "left " width= "255 "> <%=career%> </td>
</td>
</tr>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> address: </div>
<td align= "left " width= "255 "> <%=address%> </td>
</td>
</tr>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> e-mail: </div>
<td align= "left " width= "255 "> <%=email%> </td>
</td>
</tr>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> phone number: </div>
<td align= "left " width= "255 "> <%=tel%> </td>
</td>
</tr>
<tr>
<td align= "right " width= "129 ">
<div align= "right "> birthday: </div>
<td align= "left " width= "255 "> <%=year%> year <%=month%> month <%=day%> day </td>
</td>
</tr>
</tbody>
</table>
<hr width= "100% ">
<input type= "submit " name= "Submit " value= " confirm ">
<input type= "button " name= "Button " value= "back up " onClick= "backward() ">
</div>
</form>
<%
}
%>
</body>
</html>
[解决办法]
看看org.apache.jsp.reg2_jsp._jspService(reg2_jsp.java:79)
的79行,
[解决办法]
空指针
[解决办法]
报的是空指针!
你看你把值取出来了吗~?
String sql= "select * from custom where uid= ' "+uid+ " ' ";
ResultSet rs = db.executeQuery(sql);
if(rs.next())
{
rs.close();
%>
<p> sorry! the ID your selected has been regestered ,please choose another one </p>
<p> <input type= "button " name= "button2 " value= "back up " onClick= "bakcward() "> </p>
<%}
else
{
rs.close();
[解决办法]
String uid=request.getParameter( "uid ");
向这个页面传值了么?如果session中找不到叫“uid”的变量,就会报空指针
------解决方案--------------------
String uid=request.getParameter( "uid ");
String sql= "select * from custom where uid= ' "+uid+ " ' ";
应该是这里吧~~~~
改成:
if(uid!=null&&uid!= " ") { String sql= "select * from custom where uid= ' "+uid+ " ' ";
}
试试看
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html