日期:2014-05-18  浏览次数:20727 次

求助:我写的一个JSP分页的错误
我写了个JSP分页用来显示信息,却出现这个错误,请问是什么错误啊,源程序在最下面,请大家给我点指点吧     我很着急,先谢谢了

exception  

org.apache.jasper.JasperException:   Exception   in   JSP:   /fenye1.jsp:17

14:   }
15:   </script>
16:  
17:   <%
18:   //java.sql.Connection   sqlCon;   //数据库连接对象
19:   //java.sql.Statement   sqlStmt;   //SQL语句对象
20:   ResultSet   sqlRst;   //结果集对象


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root   cause  

java.lang.NullPointerException
org.apache.jsp.fenye1_jsp._jspService(fenye1_jsp.java:95)
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:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
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.20   logs.


源程序:

<%@   page   contentType= "text/html;charset=gb2312 "   %>
<%@   page   language= "java "   import= "java.sql.* "   %>
<jsp:useBean   id= "sqlbean "   scope= "page "   class= "news.Sql_data "/>
<script   language= "javascript ">
function   newwin(url)   {
var  
newwin=window.open(url, "newwin ", "toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=yes,resizable=yes,width=600,height=450 ");
newwin.focus();
return   false;
}
</script>
<%
ResultSet   sqlRst;   //结果集对象
String   strSQL;   //SQL语句
int   intPageSize;   //一页显示的记录数
int   intRowCount;   //记录总数
int   intPageCount;   //总页数
int   intPage;   //待显示页码
java.lang.String   strPage;
int   i;
//设置一页显示的记录数
intPageSize   =   4;
//取得待显示页码
strPage   =   request.getParameter( "page ");
if(strPage==null){//表明在QueryString中没有page这一个参数,此时显示第一页数据
intPage   =   1;
}
else{//将字符串转换成整型
intPage   =   java.lang.Integer.parseInt(strPage);
if(intPage <1)   intPage   =   1;
}
//装载JDBC驱动程序
strSQL   =   "select   *   from   ClientInfo   order   by   user_id   desc ";
//执行SQL语句并获取结果集
sqlRst   =   sqlbean.executeQuery(strSQL);
//获取记录总数
sqlRst.last();//??光标在最后一行
intRowCount   =   sqlRst.