错误:
HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
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
com.zk.SplitPage.initialize(SplitPage.java:14)
org.apache.jsp.search_005ffriend_005fresult_jsp._jspService(search_005ffriend_005fresult_jsp.java:101),,//我的101行是:
SplitPage.initialize(rs,10);这个问题是不是解决了空指针就没事了?
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:332)
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.17 logs.
--------------------------------------------------------------------------------Apache Tomcat/5.5.17
SplitPage.initialize方法的构建:
public void initialize(ResultSet rs,int pageSize)
   {this.pageSize=pageSize;
    try
      {this.rs=rs;
       this.rsmd=this.rs.getMetaData();
       if(this.rs!=null)
         {this.rs.last();
          this.rowCount=this.rs.getRow();
          this.rs.first();
          this.PageCount=(this.rowCount-1)/this.pageSize+1;
         }
       else
        this.rowCount=0;
      }
    catch(SQLException e)
      {System.out.println(e.toString());
      }
   }

解决方案 »

  1.   

    SplitPage.java:14应该是第14行的问题!
      

  2.   

    13:this.rs=rs;
    14:       this.rsmd=this.rs.getMetaData();
    15:       if(this.rs!=null)
      

  3.   

    你的 rs 肯的定是 null 的 。
    你在你 传入的参数那里调试。
    错误没有在这里。 是你传入的 ResultSet 为 null
      

  4.   

     if(this.rs!=null)
             {this.rs.last();
    或许rs不是null而是没有next
      

  5.   

    public void initialize(ResultSet rs,int pageSize) 
       {this.pageSize=pageSize; 
        try
          {
    if(rs!=null){
    this.rs=rs; 
           this.rsmd=this.rs.getMetaData(); 
           if(this.rs!=null) 
             {this.rs.last(); 
              this.rowCount=this.rs.getRow(); 
              this.rs.first(); 
              this.PageCount=(this.rowCount-1)/this.pageSize+1; 
             } 
           else 
            this.rowCount=0; 
          } }
        catch(SQLException e) 
          {System.out.println(e.toString()); 
          } 
       }
      

  6.   

    就是说rs.next()为空 你可以这样写if(this.rs.next()!=null)