資源簡介
springMVC+hibernate+spring+shiro整合例子
springMVC、hibernate、spring與shiro集成
代碼片段和文件信息
/**
?*?@文件名?Pagination.java
?*?@包名?com.work614.common
?*?@說明?通用分頁對象?用于承載分頁信息
?*?@作者?zdyang
?*?@時間?2014年4月8日?下午9:59:38
?*?@版本?V1.0
?*/
package?com.work614.common;
/**
?*?@類名?Pagination
?*?@author?zdyang
?*?@描述?通用分頁方法封裝?
?*?@日期?2014年4月8日?下午10:41:34
?*/
public?class?Pagination?{
/**
?*?總頁數,通過總記錄數和每頁顯示記錄條數計算獲得
?*/
private?int?totalPage;
/**
?*?總記錄數
?*/
private?int?totalCount;
/**
?*?當前頁,默認是第一頁
?*/
private?int?currentPage?=?1;
/**
?*?每頁顯示記錄條數?,默認是每頁顯示10條記錄
?*/
private?int?pageSize?=?10;
/**
?*?開始索引,通過當前頁和每頁顯示記錄條數計算獲得?
?*/
private?int?startIndex;
public?Pagination()?{
}
/**
?*?兩個參數的構造方法,調用該構造方法需要另行設置結果list
?*?
?*?@param?currentPage
?*????????????當前頁
?*?@param?countRecord
?*????????????總頁數
?*/
public?Pagination(int?currentPage?int?totalCount)?{
this.currentPage?=?currentPage;
this.totalCount?=?totalCount;
calculate();
}
/**
?*?能夠設置一頁顯示多少條記錄的構造方法
?*?
?*?@param?currentPage
?*????????????當前頁
?*?@param?countRecord
?*????????????總記錄數
?*?@param?onePageCount
?*????????????每頁最多顯示的記錄條數
?*/
public?Pagination(int?currentPage?int?totalCount?int?pageSize)?{
super();
this.totalCount?=?totalCount;
this.currentPage?=?currentPage;
this.pageSize?=?pageSize;
calculate();
}
/**
?*?計算開始索引和總頁數
?*/
private?void?calculate()?{
//?計算開始索引
this.startIndex?=?(currentPage?-?1)?*?pageSize;
//?計算總頁數
this.totalPage?=?(totalCount?%?pageSize?==?0)???(totalCount?/?pageSize)
:?(totalCount?/?pageSize?+?1);
}
//?判斷能否到第一頁;只要能到上一頁,肯定就有第一頁
public?boolean?firstEnable()?{
return?previousEnable();
}
//?判斷能否到上一頁
public?boolean?previousEnable()?{
return?currentPage?>?1;//?只要不是第一頁,就能到上一頁
}
//?判斷能否到下一頁
public?boolean?nextEnable()?{
return?currentPage?*?pageSize? }
//?判斷能否到最后一頁;只要有下一頁,就肯定有最后一頁.
public?boolean?lastEnable()?{
return?nextEnable();
}
//?跳到第一頁
public?void?firstPage()?{
currentPage?=?1;
}
//?跳到上一頁
public?void?previousPage(int?cPage)?{
currentPage?=?(cPage?-?1)?>?0???(cPage?-?1)?:?1;
}
//?跳到下一頁
public?void?nextPage(int?cPage)?{
currentPage?=?cPage?+?1;
if?(currentPage?*?pageSize?>?this.totalCount)?{
lastPage();
}
}
//?跳到最后一頁
public?void?lastPage()?{
if?(this.totalCount?%?pageSize?==?0)?{
currentPage?=?this.totalCount?/?pageSize;
}?else?{
currentPage?=?this.totalCount?/?pageSize?+?1;
}
}
//?跳到指定的某一頁
public?void?gotoPage(int?pageNumber)?{
if?(pageNumber?<=?1)?{
currentPage?=?1;
}?else?if?(getTotalCount()? currentPage?=?1;
}?else?if?(pageNumber?*?pageSize?>=?this.totalCount)?{
lastPage();
}?else?{
currentPage?=?pageNumber;
}
}
public?int?getTotalPage()?{
return?totalPage;
}
public?int?getTotalCount()?{
return?totalCount;
}
public?int?getCurrentPage()?{
return?currentPage;
}
public?int?getPageSize()?{
return?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????783??2014-04-06?18:59??test_ssh\.classpath
?????文件????????552??2014-03-29?22:19??test_ssh\.externalToolBuilders\org.eclipse.wst.common.project.facet.core.builder.launch
?????文件????????548??2014-03-29?22:19??test_ssh\.externalToolBuilders\org.eclipse.wst.jsdt.core.ja
?????文件????????547??2014-03-29?22:19??test_ssh\.externalToolBuilders\org.eclipse.wst.validation.validationbuilder.launch
?????文件???????1734??2014-03-29?22:19??test_ssh\.project
?????文件????????503??2013-05-30?10:00??test_ssh\.settings\.jsdtscope
?????文件?????????57??2014-04-04?22:43??test_ssh\.settings\org.eclipse.core.resources.prefs
?????文件????????364??2013-05-30?10:00??test_ssh\.settings\org.eclipse.jdt.core.prefs
?????文件????????553??2014-04-06?18:59??test_ssh\.settings\org.eclipse.wst.common.component
?????文件????????305??2013-05-30?16:21??test_ssh\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2013-05-30?10:00??test_ssh\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2013-05-30?10:00??test_ssh\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????4148??2014-04-08?22:41??test_ssh\src\com\work614\common\Pagination.java
?????文件???????2231??2014-04-08?22:43??test_ssh\src\com\work614\common\QueryResult.java
?????文件???????9042??2014-04-08?21:46??test_ssh\src\com\work614\common\Record.java
?????文件???????2954??2014-04-08?21:51??test_ssh\src\com\work614\common\TreeResult.java
?????文件???????2098??2014-04-10?22:06??test_ssh\src\com\work614\controller\UserController.java
?????文件???????6639??2014-04-08?22:46??test_ssh\src\com\work614\dao\ba
?????文件???????1507??2014-04-06?18:48??test_ssh\src\com\work614\dao\Iba
?????文件????????313??2014-04-06?21:37??test_ssh\src\com\work614\dao\UserDao.java
?????文件???????1166??2014-04-07?23:13??test_ssh\src\com\work614\dao\UserDaoImpl.java
?????文件???????1728??2014-04-10?22:47??test_ssh\src\com\work614\entity\Permission.java
?????文件???????1399??2014-04-10?22:16??test_ssh\src\com\work614\entity\Role.java
?????文件???????1677??2014-04-10?22:19??test_ssh\src\com\work614\entity\User.java
?????文件????????358??2014-04-07?13:04??test_ssh\src\com\work614\service\UserService.java
?????文件???????2277??2014-04-10?22:08??test_ssh\src\com\work614\service\UserServiceImpl.java
?????文件???????2711??2014-04-10?21:44??test_ssh\src\com\work614\shiro\UserAuthorizingRealm.java
?????文件??????12981??2014-04-07?21:24??test_ssh\src\com\work614\util\DateUtils.java
?????文件???????3641??2014-04-07?23:11??test_ssh\src\com\work614\util\EncryptUtils.java
?????文件??????29223??2014-04-08?21:45??test_ssh\src\com\work614\util\LangUtils.java
............此處省略715個文件信息
- 上一篇:數字信號處理第三版姚天任.zip
- 下一篇:我們自己寫的瀏覽器源代碼
評論
共有 條評論