jsp分页技术,实现高效查询Jsp如下:
<%@ page language="java" import="java.util.*,java.sql.*" %>
<%@ page contentType="text/html;charset=gb2312"%>
<%
int curpage=1;//当前页
int page_record=20;//每页显示的记录数
//用下面的方法(sql查询完成,速度快)
curpage=Integer.parseInt(request.getParameter("page"));//获取传递的值,需要显示的页
ResultSet rs=cn.rsexecuteQuery("select top "+page_record+" * from tablename where id not in (select top "+(curpage*page_record)+" id from tablename order by id desc) order by id desc");
//本查询语句得到的是所要显示的1000页的20条记录,大致思路为——子查询排除需要显示的记录前的所有记录,父查询则对余下的记录进行降序排列
while(rs.next) {
out.println(rs.getInt("id").toString());
}
rs.close();
%>
转载自:http://yyoo.cn/live/25.html
Tags: JSP编程
原创文章如转载,请注明:转载自:飞扬部落编程仓库 : http://www.busfly.net/csdn/
本文链接地址:http://www.busfly.net/csdn/post/jsp-page-split.html
如果你喜欢本文,请顶一下,支持我,你的支持是我继续发好文章的最大动力。谢谢。
好东西需要分享,快把本文发给你的朋友吧~!~