jsp+ mysql实现分页显示,jsp网页查询mysql数据库中一个学生的多科成绩显示出来,谢谢! 10
1个回答
展开全部
ConnDB cd = new ConnDB();
ct=cd.getConnDB();
ps=ct.prepareStatement("select count(*) from usertable");
rs = ps.executeQuery();
//得到pageCount的值
if(rs.next()){
rowCount = rs.getInt(1);
// pw.println(""+rowCount);测试
}
if(rowCount%pageSize==0){
pageCount = rowCount/pageSize;
}else{
pageCount = rowCount/pageSize +1;
}
ps=ct.prepareStatement("select * from usertable user_id limit "+pageSize*(pageNow-1)+","+pageSize+";");
rs=ps.executeQuery();
ct=cd.getConnDB();
ps=ct.prepareStatement("select count(*) from usertable");
rs = ps.executeQuery();
//得到pageCount的值
if(rs.next()){
rowCount = rs.getInt(1);
// pw.println(""+rowCount);测试
}
if(rowCount%pageSize==0){
pageCount = rowCount/pageSize;
}else{
pageCount = rowCount/pageSize +1;
}
ps=ct.prepareStatement("select * from usertable user_id limit "+pageSize*(pageNow-1)+","+pageSize+";");
rs=ps.executeQuery();
追问
哦
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询