==============================================
我做的是书上一个JSP分页浏览,可是什么都写上了竟然出了个空指针错误
请高手帮忙看下
错误信息:
root cause
java.lang.NullPointerException
org.apache.jsp.display_jsp._jspService(display_jsp.java:237)
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)
==============================================
JSP分页浏览页面:
<%@ page contentType= "text/html;charset=GB2312 " %>
<%@ page import= "java.sql.* " %>
<%@ page import= "user.showbypage " %>
<%@ page import= "java.io.* " %>
<jsp:useBean id= "handlePage " class= "user.showbypage " scope= "session " >
</jsp:useBean>
<HTML>
<BODY bgcolor=cyan> <font size=9>
<%! //声明一个共享的连接对象:
Connection con=null;
//显示数据库记录的方法:
public void showList(ResultSet rs,javax.servlet.jsp.JspWriter out,int n)
{try
{
out.print( " <table border=1> ");
out.print( " <TR> ");
out.print( " <TH width=50> "+ "客户登陆名 ");
out.print( " <TH width=50> "+ "真实姓名 ");
out.print( " <TH width=100> "+ "电子邮箱 ");
out.print( " <TH width=100> "+ "联系电话 ");
out.print( " <TH width=100> "+ "传真 ");
out.print( " <TH width=100> "+ "通信地址 ");
out.print( " <TH width=200> "+ "备注 ");
out.print( " </TR> ");
for(int i=1;i <=n;i++)
{
out.print( " <TR> ");
String username=rs.getString(1);
out.print( " <TD> "+username+ " </TD> ");