//s_pageNo起始页面//s_pageSize每页的大小public ListgetUsers(int pageNo, int pageSize) { connector = new JDBCConnector(); Connection con = connector.getConnectionByJDBC(); ResultSet rs = null; PreparedStatement ps = null; User user = null; List users = new ArrayList (); try { String sql = "select * from User"; ps = con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ps.setMaxRows(pageNo*pageSize); rs = ps.executeQuery(); rs.relative(pageNo - 1)*pageSize+1; while (!rs.isAfterLast()) { user = new User(); user.setId(rs.getInt("id")); user.setUserName(rs.getString("username")); user.setPassword(rs.getInt("password")); user.setCreatetime(rs.getDate("createtime")); users.add(user); rs.next(); } ps.close(); rs.close(); con.close(); connector.close(); } catch (SQLException e) { e.printStackTrace(); } return users; }