关于Oracle分页完整项目分析

POJO


package com.tl.sp.workbench.log.vo;


import java.sql.Clob;


/**
 * 对应数据库中的log_exception表
 * @author Wlc
 *
 */
public class Log_Exception  extends  Log_ExceptionPage {

private String id ;

private String recordid ;

private Clob exception ;

private String paramname ;


public String getId() {
return id;
}


public void setId(String id) {
this.id = id;
}


public String getRecordid() {
return recordid;
}


public void setRecordid(String recordid) {
this.recordid = recordid;
}


public Clob getException() {
return exception;
}


public void setException(Clob exception) {
this.exception = exception;
}


public String getParamname() {
return paramname;
}


public void setParamname(String paramname) {
this.paramname = paramname;
}


@Override
public String toString() {
return "Log_Exception [id=" + id + ", recordid=" + recordid
+ ", exception=" + exception + ", paramname=" + paramname + "]";
}





}



package com.tl.sp.workbench.log.vo;
/**
 * 分页类
 * @author Administrator
 *
 */
public class Log_ExceptionPage {


private int currentPage=1;

private int pageSize=10;

private int begin;

private int end;

private int rows;

private int totalPage;

public int getBegin() {
begin = (currentPage-1)*pageSize;
return begin;
}
public void setBegin(int begin) {
this.begin = begin;
}
public int getEnd() {
end = currentPage*pageSize+1;
return end;
}
public void setEnd(int end) {
this.end = end;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public int getTotalPage() {
int totalPage = 0;
if(rows%pageSize==0){
totalPage = rows/pageSize;
}else{
totalPage = rows/pageSize+1;
}
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}



}

后台

/**
* 功能:查询所有的log_exception
* @param page
* @param request
* @param response
*/
@RequestMapping(value="/getException",method = RequestMethod.GET)
public void getException(Log_Exception page , HttpServletRequest request, HttpServletResponse response){

//分页相关
page.setPageSize(10);
//获得总记录数
page.setRows(logMessage.getAllLogExceptionCount());

listException =logMessage.getAllException(page);

//分页查询数据
request.setAttribute("listException", listException);
System.out.println(listException);
request.setAttribute("demandPage", page);
WebUtils.forward(request, response, "/eomPortal/selectLogException.jsp");
}

@ResponseBody
@RequestMapping(value="getPageExceptionListInfo",method=RequestMethod.POST)
public Map<String,Object> getPageExceptionListInfo(Log_Exception page,HttpServletRequest request,
HttpServletResponse response){

page.setPageSize(10);
page.setRows(logMessage.getAllLogExceptionCount());
listException =logMessage.getAllException(page);

Map map = new HashMap<String, Object>(); 
map.put("listException", listException);
map.put("demandPage", page);
return map;

}


<%@page import="java.io.PrintWriter"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false"%> 
<%@page import="java.util.List"%>
<%@page import="com.tl.sp.workbench.log.vo.Log_Exception"%>
<%
String path = request.getContextPath();  
path = path.substring(0, path.lastIndexOf("/")); 
String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path;
%>    
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1">
<!-- InstanceBeginEditable name="doctitle" -->


<link rel="stylesheet" media="screen" href="/ics/ics_cms_sd/css/global.css">
<script type="text/javascript" src="<%=basePath%>/eomworkbench/scrip/html5.js"></script>
<script type="text/javascript" src="<%=basePath%>/eomworkbench/scrip/jquery.1.8.2.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/eomworkbench/scrip/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript">
function guanbi(){
$(".mask").hide(0);
$(".tb_pop").hide(0);
$("body").removeClass("lock");
}
$(function(){

menuactive(7,1);
}
);

function fileUp(fileId){
var fileId=fileId;
 window.location.href="/ics/ics_cms_sd/rest/info/download?fileId="+fileId;
}


function reset(){
$("#biaoti").val("");
$("#sysName").val("");
$("#original").val("");
$("#dateBegin").val("");
$("#dateEnd").val("");
$("#approve_dept").val("");
//$("#resolve_time").val("");
}
function subpage11(curr_page) {

pageList(curr_page);


function pageup(){

var curr_page = $("#current_page").val();
var page = (parseInt(curr_page)-1 <= 0 ? 1 :parseInt(curr_page)-1);
pageList(page);
}
function gopage1(){
/* alert("gopage1"); */
var page = document.getElementById("gopage").value;
var totalPage = document.getElementById("pagenavcount1").value;
page = (isNaN(page) ? 1 : page);
page = (page < 1 ? 1 : page);
page = (page > totalPage ? totalPage : page);
pageList(page);
}
function pagedown(){

var curr_page = $("#current_page").val();
var total_page = $("#pagenavcount1").val();
var page = (parseInt(curr_page)+1 >= parseInt(total_page) ? parseInt(total_page) : parseInt(curr_page)+1);
pageList(page);
}
function topage(curr_page){

pageList(curr_page);
}

function search1(){

pageList(1);

}

function pageList(curr_page){
var currentPage = curr_page;
/* alert("当前第几页"+currentPage); */
$.ajax({ 
type : 'POST',
url : 'getPageExceptionListInfo',
data : {
"currentPage" : currentPage,


},
success : function(msg) {

var totalrows = $("#pageNo11");
var pageRow1 = $("#pageRow1");
var totalPage = $("#pageTotal");


totalrows.empty();
totalPage.empty();
totalrows.html(msg.demandPage.currentPage); //第几页

pageRow1.html(msg.demandPage.rows);  //共多少条
totalPage.html(msg.demandPage.totalPage);  //分几页

var length = msg.listException.length;
$("#selectL tbody").empty(); 
$("#current_page").val(msg.demandPage.currentPage);
$("#pagenavcount1").val(msg.demandPage.totalPage);


if(length > 0){
for(i = 0 ; i < length ; i ++){
var $tr = $("<tr align='center'></tr>");
$tr.append('<td align="center">'+msg.listException[i].id+'</td>');
$tr.append('<td align="center">'+msg.listException[i].recordid+'</td>');
$tr.append('<td align="center">'+msg.listException[i].exception+'</td>');
$tr.append('<td align="center">'+msg.listException[i].paramname+'</td>');
$("#selectL tbody").append($tr);



}
}

}
});
}
</script>
</head>
<body  width="100%">
<div width="100%">
  <form>
  
    <table frame="border" rules="all" border="3px"  cellpadding="5px" width="500px" height="300px" 
      id = "selectL">
 <thead>
 <tr id="myt">
  <td>ID</td>
  <td>记录ID</td>
  <td>异常信息</td>
  <td>参数名字</td>
  </tr> 
  </thead>
 <tbody>
<%
            int num=1;
            List<Log_Exception> list=(List)request.getAttribute("listException");
        for(Object ob:list){
        Log_Exception bean=(Log_Exception)ob;
       %>
          <tr align="center">
          <td><%=bean.getId() %></td>
          <td><%=bean.getRecordid()%></td>
  <td><%=bean.getException()%></td>
  <td><%=bean.getException()%></td>
</tr>
<% num++;} %>
</tbody>
    </table>
    </form>
</div>
<div id="result">
<div class="page">共<b id="pageRow1">${demandPage.rows}</b>条  分<b id="pageTotal">${demandPage.totalPage}</b>页 当前第
<input  name="currentPage" id="current_page" value="${demandPage.currentPage}"  type="hidden"/> 
<b id="pageNo11">${demandPage.currentPage}</b>页 
<a οnclick="subpage11(1)">首页</a> 
<a οnclick="pageup();">上一页</a>
<a οnclick="pagedown();">下一页</a>
<a οnclick="topage(${demandPage.totalPage});">末页</a>
<input name="__totalpage" id="pagenavcount1" value="${demandPage.totalPage}" type="hidden"/>
&nbsp; &nbsp; 第 <input type="text" id="gopage" class="input1" name="textfield3" id="textfield3"> 页 <input type="submit" οnclick="gopage1();" class="btn1" value="跳转" /></div>
</div>
</body>







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>