濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > jsp hibernate的分頁(yè)代碼第1/3頁(yè)

jsp hibernate的分頁(yè)代碼第1/3頁(yè)

熱門標(biāo)簽:電話機(jī)器人的特色和創(chuàng)新 地圖標(biāo)注人員兼職 淮南騰訊地圖標(biāo)注 漯河辦理400電話 商丘百應(yīng)電話機(jī)器人有沒(méi)有效果 怎樣把地圖標(biāo)注出來(lái) 開(kāi)封便宜外呼系統(tǒng)報(bào)價(jià) 騰訊地圖標(biāo)注商戶改名注冊(cè)入駐 黃石智能營(yíng)銷電銷機(jī)器人效果
可見(jiàn)使用Hibernate,在進(jìn)行查詢分頁(yè)的操作上,是具有非常大的靈活性,Hibernate會(huì)首先嘗試用特定數(shù)據(jù)庫(kù)的分頁(yè)sql,如果沒(méi)用,再嘗試Scrollable,如果不行,最后采用rset.next()移動(dòng)的辦法。
(一)pager類
* @(#)Pager.java 2005-5-3
*
* Copyright (c) 2005, Jeffrey Hsu
*/
package com.jeffrey.messagelove;
/**
* Pager holds the page info.
*/
public class Pager {
private int totalRows = 0; // 記錄總數(shù)
private int totalPages = 0; // 總頁(yè)數(shù)
private int pageSize = 10; // 每頁(yè)顯示數(shù)據(jù)條數(shù),默認(rèn)為10條記錄
private int currentPage = 1; // 當(dāng)前頁(yè)數(shù)
private boolean hasPrevious = false; // 是否有上一頁(yè)
private boolean hasNext = false; // 是否有下一頁(yè)
public Pager() {
}
/**
* Initialize Pager
* @param totalRows total record rows
* @param pageSize total record is hold by every page
*/
public void init(int totalRows, int pageSize) {
this.totalRows = totalRows;
this.pageSize = pageSize;
totalPages = ((totalRows + pageSize) - 1) / pageSize;
refresh(); // 刷新當(dāng)前頁(yè)面信息
}
/**
* @return Returns the currentPage.
*/
public int getCurrentPage() {
return currentPage;
}
/**
* @param currentPage current page
*/
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
refresh();
}
/**
* @return Returns the pageSize.
*/
public int getPageSize() {
return pageSize;
}
/**
* @param pageSize The pageSize to set.
*/
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
refresh();
}
/**
* @return Returns the totalPages.
*/
public int getTotalPages() {
return totalPages;
}
/**
* @param totalPages The totalPages to set.
*/
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
refresh();
}
/**
* @return Returns the totalRows.
*/
public int getTotalRows() {
return totalRows;
}
/**
* @param totalRows The totalRows to set.
*/
public void setTotalRows(int totalRows) {
this.totalRows = totalRows;
refresh();
}
// 跳到第一頁(yè)
public void first() {
currentPage = 1;
this.setHasPrevious(false);
refresh();
}
// 取得上一頁(yè)(重新設(shè)定當(dāng)前頁(yè)面即可)
public void previous() {
currentPage--;
refresh();
}
// 取得下一頁(yè)
public void next() {
System.out.println("next: totalPages: " + totalPages +
" currentPage : " + currentPage);
if (currentPage totalPages) {
currentPage++;
}
refresh();
}
// 跳到最后一頁(yè)
public void last() {
currentPage = totalPages;
this.setHasNext(false);
refresh();
}
public boolean isHasNext() {
return hasNext;
}
/**
* @param hasNext The hasNext to set.
*/
public void setHasNext(boolean hasNext) {
this.hasNext = hasNext;
}
public boolean isHasPrevious() {
return hasPrevious;
}
/**
* @param hasPrevious The hasPrevious to set.
*/
public void setHasPrevious(boolean hasPrevious) {
this.hasPrevious = hasPrevious;
}
123下一頁(yè)閱讀全文
您可能感興趣的文章:
  • jsp分頁(yè)顯示的實(shí)現(xiàn)代碼
  • JSP分頁(yè)顯示的實(shí)例代碼
  • 一個(gè)實(shí)用的JSP分頁(yè)代碼
  • JSP實(shí)現(xiàn)的簡(jiǎn)單分頁(yè)示例
  • JSP自定義分頁(yè)標(biāo)簽TAG全過(guò)程
  • jsp+servlet+javabean實(shí)現(xiàn)數(shù)據(jù)分頁(yè)方法完整實(shí)例
  • JSP通用高大上分頁(yè)代碼(超管用)
  • jsp實(shí)現(xiàn)頁(yè)面分頁(yè)功能代碼
  • 一個(gè)通用的jsp分頁(yè)P(yáng)ageBean
  • JSP實(shí)現(xiàn)分頁(yè)效果

標(biāo)簽:拉薩 亳州 鄭州 武威 岳陽(yáng) 馬鞍山 大興安嶺 紅河

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《jsp hibernate的分頁(yè)代碼第1/3頁(yè)》,本文關(guān)鍵詞  jsp,hibernate,的,分頁(yè),代碼,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《jsp hibernate的分頁(yè)代碼第1/3頁(yè)》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于jsp hibernate的分頁(yè)代碼第1/3頁(yè)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    石嘴山市| 健康| 柳林县| 新邵县| 台中县| 昌图县| 海城市| 景谷| 和政县| 鄂托克旗| 沾益县| 仁寿县| 吉安县| 黑龙江省| 井陉县| 盐边县| 桦甸市| 县级市| 吉安县| 宜兰市| 全南县| 疏勒县| 无极县| 化隆| 富源县| 奉化市| 连江县| 垦利县| 额尔古纳市| 雷州市| 蒙阴县| 平潭县| 萝北县| 唐山市| 钟祥市| 渑池县| 阳新县| 揭东县| 东海县| 望城县| 竹溪县|