分页中帮忙看下错在哪里了,来者有分。急啊
<%@ page language="java" contentType="text/html; charset=GBk"
pageEncoding="GBk"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import= "java.sql.*,java.util.*, com.addr.dao.*,com.addr.dao.impl.*,com.addr.vo.*" %>
<%
final int PAGE_SIZE = 4;
int pageNo = 1;
String strPageNo = request.getParameter("pageNo");
if(strPageNo != null && !strPageNo.trim().equals("")) {
try {
pageNo = Integer.parseInt(strPageNo);
} catch (NumberFormatException e) {
pageNo = 1;
}
}
if(pageNo <= 0) {
pageNo = 1;
}
int totalPages = 0;
List list = new ArrayList();
Connection conn = DB.getConn();
String sql = "select count(*) from addressbook";
PreparedStatement pstmt = DB.prepare(conn, sql);
int totalRecords = 0;
try{
ResultSet rs = DB.getResultSet(pstmt);
if(rs.next()){
totalRecords = rs.getInt(1);
}
} catch(Exception e){
e.printStackTrace();
}
totalPages = (totalRecords + PAGE_SIZE - 1)/PAGE_SIZE;
if(pageNo > totalPages){
pageNo = totalPages;
}
String sqlStr = "select * from addressbook order by name";
PreparedStatement pst = conn.prepareStatement(sqlStr);
int startPos = (pageNo-1) * PAGE_SIZE;
//String sql = "select * from article where pid = 0 order by pdate desc limit " + startPos + "," + PAGE_SIZE ;
System.out.println(sql);
ResultSet rs = pst.executeQuery();
rs.setFetchSize(PAGE_SIZE);
int absoluteLocation = PAGE_SIZE * (pageNo - 1) + 1;
//System.out.println("绝对定位于: " + absoluteLocation);
if (rs.absolute(absoluteLocation) == false) {
System.out.println("nih oa");
}
while(rs.next()) {
PersonMessage pm = new PersonMessage();
pm.setName(rs.getString("name"));
pm.setPhone(rs.getString("phone"));
pm.setAddress(rs.getString("address"));
}
DB.close(rs);
DB.close(pstmt);
DB.close(conn);
%>
<table align="right" border="0" cellpadding="0" cellspacing="0" width="90%">
<tr>
<td colspan="2" >
当前位置:第 <%=pageNo %>页
共 <%=totalPages %> 页
</td>
<td colspan="2" >
<a href="mainMenu.jsp?pageNo=1" >第一页 </a> 
<a href="mainMenu.jsp?pageNo-1">上一页 </a> 
<a href="mainMenu.jsp?pageNo+1">下一页 </a> 
<a href="mainMenu.jsp?pageNo= <%=totalPages %>">最末页 </a>
</td>
</tr>
</table>
错误信息org.apache.jasper.JasperException: An exception occurred processing JSP page /mainMenu.jsp at line 53
50: rs.setFetchSize(PAGE_SIZE);
51: int absoluteLocation = PAGE_SIZE * (pageNo - 1) + 1;
52: //System.out.println("绝对定位于: " + absoluteLocation);
53: if (rs.absolute(absoluteLocation) == false) {
54: System.out.println("nih oa");
55: }
56: while(rs.next()) {
帮忙解决下。谢谢了