${pager.totalpage}是总页数
<c:forEach begin="1" end="${pager.totalpage}" var="i" >
<a href='javascript:void(0);' name='number1'>${i}</a>
</c:forEach>
这样就可以在页面上显示 上一页 1 2 3 4 5 6 7 8 9 10 下一页
//
<c:forEach items="${pager.resultList}" var="p">
<span class="perby2">
<span class="perby2_bt">
<!-- <input name="" type="checkbox" value="" class="checkbox2">-->
<span class="fl">配资编号:${p['product_code']}</span>
<!-- <a class="delete" href="javascript:void(0)"></a> -->
<span class="fr">结束时间:${p['end_date']}</span>
<span class="fr fr2">开始时间:${p['start_date']}</span>
</span>
<table width="758" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="114" height="91" align="center"><span style="font-size:20px;">${p['totalmoney']}</span>元<br>
总操盘资金</td>
<td width="115" align="center"><span style="font-size:20px;">${p['matching_money']}</span>元<br>
实盘资金</td>
<td width="115" align="center"><span style="font-size:20px;">${p['caution_money']}</span>元<br>
风险保证金</td>
<td width="115" align="center"><span style="font-size:20px;">${p['service_charge']}</span>元/天<br>
管理费</td>
<c:choose>
<c:when test="${p['matching_state']=='1'}">
<c:choose>
<c:when test="${p['is_pay']== '1'}">
<td width="160" align="center"><span style="color:#e62119;">审核中</span></td>
<td width="134" align="center" style="border-right:none;">
<input type="submit" name="button" class="button2" value="查看详细信息">
</td>
</c:when>
<c:otherwise>
<td width="160" align="center"><span style="color:#e62119;">未付保证金</span></td>
<td width="134" align="center" style="border-right:none;">
<input type="submit" name="button" class="button2" value="支付保证金">
</td>
</c:otherwise>
</c:choose>
</c:when>
<c:when test="${p['matching_state']=='2'}">
<td width="160" align="center"><span style="color:#e62119;">操盘中</span></td>
<td width="134" align="center" style="border-right:none;">
<input type="submit" name="button" class="button2" value="查看详细信息">
</td>
</c:when>
<c:when test="${p['matching_state']=='3'}">
<td width="160" align="center"><span style="color:#e62119;">终止</span></td>
<td width="134" align="center" style="border-right:none;">
<input type="submit" name="button" class="button2" value="查看详细信息">
</td>
</c:when>
<c:when test="${p['matching_state']=='4'}">
<c:if test="${p['excess_loss']>'0'}">
<td width="160" align="center"><span style="color:#e62119;">超额亏损</span></td>
<td width="134" align="center" style="border-right:none;">
<input type="submit" name="button" class="button2" value="支付超额亏损金">
</td>
</c:if>
<c:if test="${p['excess_loss']=='0'}">
<td width="160" align="center"><span style="color:#e62119;">结束</span></td>
<td width="134" align="center" style="border-right:none;">
<input type="submit" name="button" class="button2" value="查看详细信息">
</td>
</c:if>
</c:when>
<c:when test="${p['matching_state']=='5'}">
<td width="160" align="center"><span style="color:#e62119;">停牌</span></td>
<td width="134" align="center" style="border-right:none;">
<input type="submit" name="button" class="button2" value="停牌继续持有">
</td>
</c:when>
</c:choose>
</tr>
</table>
</span>
</c:forEach>
<span id='pagina'>
<c:if test='${pager.curPageNO == 1}'>
<a href='javascript:void(0);' onclick="javaScript:alert('当前已经是首页!');">首页</a>
</c:if>
<c:if test='${pager.curPageNO != 1}'>
<a href='javascript:void(0);' onclick="tye1(${status},1)">首页</a>
</c:if>
<c:if test='${pager.curPageNO == 1}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是第一页!');">上一页</a>
</c:if>
<c:if test='${pager.curPageNO != 1}'>
<a href='javascript:void(0);' onclick="tye1(${status},${pager.curPageNO - 1})">上一页</a>
</c:if>
<c:forEach begin="1" end="${pager.totalpage}" var="i" >
<a href='javascript:void(0);' name='number1'>${i}</a>
</c:forEach>
<c:if test='${pager.curPageNO == pager.totalpage}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是最后一页!');">下一页</a>
</c:if>
<c:if test='${pager.curPageNO != pager.totalpage}'>
<a href='javascript:void(0);' onclick="tye1(${status},${pager.curPageNO + 1})">下一页</a>
</c:if>
<c:if test='${pager.curPageNO == pager.totalpage}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是尾页!');">尾页</a>
</c:if>
<c:if test='${pager.curPageNO != pager.totalpage}'>
<a href='javascript:void(0);' onclick="tye1(${status},${pager.totalpage})">尾页</a>
</c:if>
</span>
<script type="text/javascript">
function tye1(status,pageno){
if(status == -1){ //待支付
$("#tab_2").load("/personalCenter.do?dayAccountList&pageNo="+pageno+"&ispay=0&status=-1");
scroll(0,20);
}else if(status == 99){ //查找全部
$("#tab_1").load("/personalCenter.do?dayAccountList&pageNo="+pageno);
scroll(0,20);
}else if(status == 4){ //终止
$("#tab_4").load("/personalCenter.do?dayAccountList&status="+status+"&pageNo="+pageno);
scroll(0,20);
}else if(status == 2){ //交易
$("#tab_31").load("/personalCenter.do?dayAccountList&status="+status+"&pageNo="+pageno+"&pageIndex=${pageIndex}");
if("${pageIndex}"==2){
scroll(0,450);
}else{
scroll(0,20);
}
}
}
//当前页加色
$("[name='number1']").each(function(u){
if($(this).html() == "${pager.curPageNO}"){
$(this).addClass("number");
}
});
</script>
后台封装Pager对象
PageList page=new PageList();
page.setResultList(listmap); //查询出来的集合
page.setCurPageNO(curPageNO); //当前页
page.setPagerows(pagerows); //每页页多少条
page.setTotalpage(count%pagerows==0?count/pagerows:count/pagerows+1); //总页数
page.setCount(count); //总条数
注意:
sql 分页
sql.append(" LIMIT "+(curPageNO-1)*pagerows+","+pagerows);