int pageSize = 50; //每页显示几条记录
int pageTotal = 0; //页数
int pageIndex=1;//当前是第几页
if (totalCount % pageSize == 0) {
pageTotal = totalCount / pageSize;
} else {
pageTotal = totalCount / pageSize + 1;
}
String pageStr = request.getParameter("page");
if (pageStr != null) {
pageIndex = Integer.parseInt(pageStr);
}
pageIndex = pageIndex <= 0 ? 1 : pageIndex;
pageIndex = pageIndex > pageTotal ? pageTotal : pageIndex;
int start = (pageIndex - 1) * pageSize + 1;
int end = pageIndex * pageSize;
当前第<%=pageIndex%>页/总<%=pageTotal%>页
<%if(pageTotal==1||pageIndex==1){ %>
首页
<%}else{ %>
首页
<%} %>
<%if(pageIndex==1){ %>
上页
<%}else{ %>
上页
<%} %>
<%if(pageIndex==pageTotal){ %>
下页
<%}else{ %>
下页
<%} %>
<%if(pageTotal==1||pageIndex==pageTotal){ %>
末页
<%}else{ %>
末页
<%} %>
|
sql语句:select wid,w_fmc,w_je,w_rq from (select *,ROW_NUMBER() OVER (ORDER BY w_fmc,w_rq,wid) as rank from as_rixiaos where w_rq>='"+startTime+"' and w_rq<='"+endTime+"' and w_fmc='"+name+"') as t where t.rank between "+start+" and "+end+"
阅读(868) | 评论(0) | 转发(0) |