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PXSPMym6njNe0D10jzPoHiPoHrrHGXSPEXQP3ePM3/zs07h3IR2887PP4t6FeED3RPG17/z6nYXPvv/+Oi6U5Z2Fz772nV/H3VbxgO4hSDygewgSD+gegsQDuocg8YDuIUg8uO79H5ayVvsde/iBAAAAAElFTkSuQmCC" alt="" />

前台jsp代码如下:

<div class="listNav">
<div class="instruction">
您正在查看${result }个结果中的第${start+1 }-${limit }项结果。
</div>
<fieldset><legend>首页</legend>
<input type="button" name="eventSubmit_doList_first" onclick="javascript:window.location.href='${pageContext.request.contextPath}/cw/allSiteCourse.do?start=0&limit=${limit}'" value="|<">
</fieldset>
<fieldset><legend>前一页</legend>
<input type="button" name="eventSubmit_doList_prev" onclick="javascript:window.location.href='${pageContext.request.contextPath}/cw/allSiteCourse.do?start=${start-limit }&limit=${limit}'" value="<">
</fieldset>
<select name="selectPageSize" id="selectPageSize" onchange="changePager(this.value)">
<option value="5">显示5项…</option>
<option value="10">显示10项…</option>
<option value="20" selected>显示20项…</option>
<option value="50">显示50项…</option>
<option value="100">显示100项…</option>
<option value="200">显示200项…</option>
<fieldset><legend>后一页</legend>
<input type="button" name="eventSubmit_doList_next" onclick="javascript:window.location.href='${pageContext.request.contextPath}/cw/allSiteCourse.do?start=${start+limit }&limit=${limit}'" value=">">
</fieldset>
<fieldset><legend>尾页</legend>
<input type="button" name="eventSubmit_doList_last" onclick="javascript:window.location.href='${pageContext.request.contextPath}/cw/allSiteCourse.do?start=${result }&limit=${limit}'" value=">|">
</fieldset>
</div>

controller如下:

@RequestMapping(value="/allSiteCourse",method=RequestMethod.GET)
public String allSiteCourse(HttpServletRequest request,Pager pager){
//查询数据库中所有的条数
int result = cwInfoService.queryAllSitesCount();
//设置分页
pager = cwInfoService.setPage(pager, result);
List<Sites> siteList = cwInfoService.queryAllSites(pager);
request.setAttribute("siteList", siteList);
request.setAttribute("start", pager.getStart());
request.setAttribute("limit", pager.getLimit());
request.setAttribute("result", result);
return "/jsp/coursewareSelectAllSites";
}

service,以及实现类如下:

/**
* 描述:查询出所有的站点总共有多少个
* @return
*/
int queryAllSitesCount();
/**
* 描述:设置分页的起始条数
* @param pager
* @return
*/
Pager setPage(Pager pager,int result);
@Override
public int queryAllSitesCount() {
return cwInfoDao.queryAllSitesCount();
} @Override
public Pager setPage(Pager pager,int result) {
//总共多少页
int pageCount = 0;
//最后一页的起始条数
int lastStart = 0;
if(pager.getLimit()!=null){
//根据余数判断最后一页是否是满
if(result%pager.getLimit()==0){
//计算出当前数据总共有多少页
pageCount = result/pager.getLimit();
//当前页数小于一页
if(pageCount<=1){
lastStart = 0;
}else{
lastStart = result-pager.getLimit();
}
}else{
pageCount = (result/pager.getLimit())+1;
if(pageCount<=1){
lastStart = 0;
}else{
lastStart = (pageCount-1)*pager.getLimit();
}
}
}
//设置分页
if(!(pager.getStart()!=null&&pager.getLimit()!=null)){
pager.setStart(0);
pager.setLimit(20);
//前一页出现负值情况
}else if(pager.getStart()<0){
pager.setStart(0);
//当前页的数据不够一页
}else if(result-pager.getLimit()<0){
pager.setStart(0);
//下一页出现超出数据情况
}else if(pager.getStart()>=result){
pager.setStart(lastStart);
}
return pager;
}

dao以及底层springJDBC:

/**
* 描述:查询所有的站点信息
* @return
*/
List<Sites> queryAllSites(Pager pager);
/**
* 描述:查询出所有的站点总共有多少个
* @return
*/
int queryAllSitesCount();
@Override
public List<Sites> queryAllSites(Pager pager) {
String sql = "select * from sakai_site order by SITE_ID limit ?,?";
Object[] obj = new Object[]{pager.getStart(),pager.getLimit()};
List<Sites> list = jdbcTemplate.query(sql,obj, new siteMapper());
return list;
}
@Override
public int queryAllSitesCount() {
String sql = "select count(*) from sakai_site";
int result = jdbcTemplate.queryForObject(sql,Integer.class);
return result;
}
class siteMapper implements RowMapper<Sites>{

    @Override
public Sites mapRow(ResultSet rs, int rowNum) throws SQLException {
Sites site = new Sites();
site.setCreatedby(rs.getString("CREATEDBY"));
site.setCreatedon(rs.getDate("CREATEDON"));
site.setCustomPageOrdered(rs.getString("CUSTOM_PAGE_ORDERED"));
site.setDescription(rs.getString("DESCRIPTION"));
site.setIconUrl(rs.getString("ICON_URL"));
site.setInfoUrl(rs.getString("INFO_URL"));
site.setIsSoftlyDeleted(rs.getString("IS_SOFTLY_DELETED"));
site.setIsSpecial(rs.getString("IS_SPECIAL"));
site.setIsUser(rs.getString("IS_USER"));
site.setJoinable(rs.getString("JOINABLE"));
site.setJoinRole(rs.getString("JOIN_ROLE"));
site.setModifiedby(rs.getString("MODIFIEDBY"));
site.setModifiedon(rs.getDate("MODIFIEDON"));
site.setPublished(rs.getInt("PUBLISHED"));
site.setPubview(rs.getString("PUBVIEW"));
site.setShortDesc(rs.getString("SHORT_DESC"));
site.setSiteId(rs.getString("SITE_ID"));
site.setSkin(rs.getString("SKIN"));
site.setSoftlyDeletedDate(rs.getDate("SOFTLY_DELETED_DATE"));
site.setTitle(rs.getString("TITLE"));
site.setType(rs.getString("TYPE"));
return site;
}
}

还有一个简短的js:

//分页
function changePager(obj){
window.location.href=ctx + "/cw/allSiteCourse.do?start=0&limit="+obj;
}
$(document).ready(function(){
if(limit!=''){
$('option[value='+limit+']').attr('selected',true);
}
});

springJDBC实现mysql简单分页的更多相关文章

  1. MyBatis+mysql 简单分页

    注意:limit不能跟动态内容 <select id="fenYe" parameterType="int" resultType="com.x ...

  2. MySql简单分页存储过程

    BEGIN DECLARE startIndex int; select COUNT(*) INTO RecordCount from test; SET startIndex = (PageInde ...

  3. 简单的PHP+Mysql实现分页

    <?php /** * PHP+Mysql实现分页 * **/ ?> <html> <head> <meta http-equiv="Content ...

  4. Mysql中分页查询两个方法比较

    mysql中分页查询有两种方式, 一种是使用COUNT(*)的方式,具体代码如下 1 2 3 SELECT COUNT(*) FROM foo WHERE b = 1;   SELECT a FROM ...

  5. MySQL高效分页-mybatis插件PageHelper改进

    MySQL分页在表比较大的时候,分页就会出现性能问题,MySQL的分页逻辑如下:比如select * from user limit 100000,10 它是先执行select * from user ...

  6. Oracle和MySql的分页查询区别和PL/SQL的基本概念

    Oracle和MySql的分页查询区别:     Oracle的分析查询,之前Oracle的分页是使用伪列 ROWNUM 结合子查询实现,mysql的分页更简单,直接使用 LIMIT 关键字就可以实现 ...

  7. mysql 深度分页

    mysql  分页查询使我们常见的需求 ,但是随着页数的增加查询性能会逐渐下降,尤其是到深度分页的情况.我们可以把分页分为两个步骤,1.定位偏移量,2.获取分页条数的 数据. 所以当数据较大页数较深时 ...

  8. JavaScript简单分页,兼容IE6,~3KB

    简介 兼容IE6+及现代浏览器的简单分页,支持同一页面多个分页. 使用 Browser <link rel="stylesheet" href="css/GB-pa ...

  9. MySQL的分页优化

    今天下午,帮同事重写了一个MySQL SQL语句,该SQL语句涉及两张表,其中一张表是字典表(需返回一个字段),另一张表是业务表(本身就有150个字段,需全部返回),当然,字段的个数是否合理在这里不予 ...

随机推荐

  1. 进化策略-python实现

    ESIndividual.py import numpy as np import ObjFunction class ESIndividual: ''' individual of evolutio ...

  2. 如何使用lessc编译.less文件

    LESS :一种动态样式语言. LESS 将 CSS 赋予了动态语言的特性,如 变量, 继承, 运算, 函数. LESS 既可以在 客户端 上运行 (支持IE 6+, Webkit, Firefox) ...

  3. USACO 3.2 ratios 高斯消元

    题目原意很简单,就是解一个三元一次方程组 直接高斯消元解方程组,枚举最后一列的倍数(k) 注意double的精度,有很多细节需要处理 /* PROB:ratios LANG:C++ */ #inclu ...

  4. Uva11134 Fabled Rooks

    普通的贪心题. 虽然图是二维的,但可以把横向和纵向分开处理. 将区间按右端点排序,然后从区间左端点到右端点找第一个空位置放棋子即可. /*by SilverN*/ #include<algori ...

  5. Aho-Corasick算法、多模正则匹配、Snort入门学习

    希望解决的问题 . 在一些高流量.高IO的WAF中,是如何对规则库(POST.GET)中的字符串进行多正则匹配的,是单条轮询执行,还是多模式并发执行 . Snort是怎么组织.匹配高达上千条的正则规则 ...

  6. PHP函数篇详解十进制、二进制、八进制和十六进制转换函数说明

    PHP函数篇详解十进制.二进制.八进制和十六进制转换函数说明 作者: 字体:[增加 减小] 类型:转载   中文字符编码研究系列第一期,PHP函数篇详解十进制.二进制.八进制和十六进制互相转换函数说明 ...

  7. 本地与在线图片转Base64及图片预览

    查看效果:http://sandbox.runjs.cn/show/tgvbo9nq 本地图片转Base64(从而可以预览图片): function localImgLoad() { var src ...

  8. fork Bomb

    类Unix ;(){:|:&};: windows %0|%0

  9. sockaddr & sockaddr_in struct

    struct sockaddr { unsigned short sa_family; /* address family, AF_xxx */ ]; /* 14 bytes of protocol ...

  10. rwsr-sr-x类似权限设置

    如何设置suid/guid? 如果希望设置suid,那么就将相应的权限位之前的那一位设置为4:如果希望设置guid,那么就将相应的权限位之前的那一位设置为2:如果希望两者都置位,那么将相应的权限位之前 ...