张家力的分页显示
limit在java当中可以用变量来控制当前页数显示的记录条数
Object page1 = session.getAttribute("page1");
String sql = "select * from person limit "
+page1+","+((Integer)page1+5)+"";
ResultSet rs = op.getSQL(sql);
while(rs.next()){
}
而控制上下页只需要后台对page1进行控制变量即可
int n = 0;
String sql="select * from person";
operation op = new operation();
ResultSet rs = op.getSQL(sql);
while(rs.next()){
n++;
}
Object page1 = session.getAttribute("page1");
int p = (Integer)page1;
if(p<n-5){
p+=5; //下一页
}
session.setAttribute("page1", p);
response.setHeader("refresh", "0;url=adm.jsp");