标题:NullPionterException 问题
只看楼主
lmc322
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-2-17
 问题点数:0 回复次数:2 
NullPionterException 问题

异常为:
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:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NullPointerException
org.apache.jsp.board1_jsp._jspService(org.apache.jsp.board1_jsp:117)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.9
代码:<%@page contentType="text/html;charset=GB2312"%>
<%request.setCharacterEncoding("GB2312");%>
<jsp:useBean id="bean" scope="page" class="test.dbcon"/>
<%
int count=0,lastp=1,numf,numl,prep,nextp,pageno=1,id;
ResultSet rs=null,rs1=null;
if(request.getParameter("pageno")==null)
pageno=0;
else
pageno=Integer.parseInt(request.getParameter("pageno"));
out.print(pageno);
rs1=bean.executeSQL("select*from message");
while(rs1.next())
count++;
lastp=(int)Math.ceil((double)count/5);
if(pageno==0||pageno>lastp)
pageno=lastp;
numf=pageno*5-4;
numl=numf+4;
if(pageno==1)
prep=1;
else
prep=pageno-1;
if(pageno==lastp)
nextp=lastp;
else
nextp=pageno+1;
%>
<font size=7 color=green>专家留言板</font>
<hr>
<center>
<form action=board1.jsp method=post>
<table border=0>
<tr>
<td>目前页次:<font color=red><%=pageno%></font>/
<font color=blue><%=lastp%></font></td>
<td><a href=board1.jsp?pageno=<%=prep%>>[上一页]</a></td>
<td><a href=board1.jsp?pageno=<%=nextp%>>[下一页]</a></td>
<td><a href=board1.jsp?pageno=1>[第一页]</a></td>
<td><a href=board1.jsp>[最后一页]</a></td><td>输入页次:
<input type=text size=3 name=pageno></td>
<td><input type=submit name=SEND value=送出></td>
<td><a href=password1.jsp><font color=red size="5">
<i>站长专用</i></font></a></td>
</tr>
</table>
</form>
<%
String name,email,subject,time,sex,memo;
rs=bean.executeSQL("select*from message where id between"+numf+"and"+numl);
while(rs.next())
{
name=rs.getString(1);
email=rs.getString(2);
subject=rs.getString(3);
time=rs.getString(4);
sex=rs.getString(5);
memo=rs.getString(6);
out.print("<center>");
out.print("<table border=1>");
out.print("<tr><td bgcolor=yellow>姓名</td><td>"+name+"</td></tr>");
out.print("<tr><td bgcolor=yellow>E-mail</td><td>"+email+"</td></tr>");
out.print("<tr><td bgcolor=yellow>时间</td><td>"+time+"</td></tr>");
out.print("<tr><td bgcolor=yellow>主题</td><td>"+subject+"</td></tr>");
out.print("<tr><td valign=top bgcolor=yellow>留言</td><td>"+memo+"<img src="+sex+"></td></tr>");
out.print("</table><p>");
}
rs.close();
%>
<hr>
<center><a href=message1.html>我要留言</a>
<a href=board1.jsp>查看留言</a>
</body>
</html>

搜索更多相关主题的帖子: jasper apache java org The 
2006-05-23 11:39
lmc322
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-2-17
得分:0 

有没有哪位大哥给解决一下啊

2006-05-23 13:29
yangwudong
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:244
专家分:0
注 册:2005-8-18
得分:0 
又是一个写到jsp上的,你把处理写到servlet上,这样好判断是哪里错了!这样不好看!

别做程序了,给你们一个赚钱的秘诀。做豆腐;if 做硬了 then 卖豆腐干;if 做稀了 then 卖豆腐花;if 太稀了 then 卖豆浆;if 豆腐卖不动了放几天 then 卖臭豆腐; else if 还卖不动放坏了 then 卖腐乳;
2006-05-24 10:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-66450-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.825460 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved