| <%@include file="../Left.jsp"%> |
|
<%
int pagesize = 15; //每页显示的条数
int countrow; //总行数
int countpage; //总页数
int pages; //将要显示的页
int i=0; //已经显示记录条
String strPage = request.getParameter("page");
String sql;
String csql;
if(strPage==null){
pages = 1;
}else{
pages = Integer.parseInt(strPage);
}
String strType = request.getParameter("type");
if(strType==null){
csql = "select count(id) as count from short";
countrow = log.countRow(csql);
//sql = "select id,type,msg from short order by id desc";
i = pagesize*pages-pagesize;
sql = "select id,type,msg from (select rownum num,id,type,msg from (select id,type,msg from short order by id desc) where rownum<=(" + i + "+" + pagesize +"))where num >" + i ;
}else{
csql = "select count(id) as count from short where type =" + strType;
countrow = log.countRow(csql);
//sql = "select id,type,msg from short where type="+strType+" order by id desc";
i = pagesize*pages-pagesize;
sql = "select id,type,msg from (select rownum num,id,type,msg from (select id,type,msg from short where type="+strType+" order by id desc) where rownum<=(" + i + "+" + pagesize +"))where num >" + i ;
}
//i = pagesize*pages;
//out.print(sql);
countpage = (countrow+pagesize-1)/pagesize;
dbs.connect("oracle");
dbs.query(sql);
//for(int k = pagesize; k < i; k++){
//dbs.nextRecord();
//}
%>
| 共<%=countpage%>页
|
<%if(strType == null){%>
<%if(pages == 1){%>
上页
<%}else{%>
上页
<%}%>
|
<%if(pages == countpage){%>
下页
<%}else{%>
下页
<%}%>
<%}else{%>
<%if(pages == 1){%>
上页
<%}else{%>
上页
<%}%>
|
<%if(pages == countpage){%>
下页
<%}else{%>
下页
<%}%>
<%}%>
|
|
|
|
<%
int id = 0;
String type = "";
String msg = "";
//int j = 0;
while(dbs.nextRecord()){
// j++;
id = dbs.getInt("id");
msg = dbs.getString("msg");
%>
|
|
|
<%} dbs.close();%>
|
|