<c:choose>
<c:when test="${maxPage == 0}">
<div align="center"><h3><font color="red">没有数据!!!!!</font></h3></div>
</c:when>
<c:otherwise>
<table width="100%" bgcolor="whitesmoke" border="0" align="center" cellpadding="2" cellspacing="2" class="list_bt">
<tr>
<td align="center">
总共【<font color="red">${maxPage}</font>】页 <font color="red">${page}</font>/<font color="red">${maxPage}</font>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=1&username=<%=user.getRealName() %>">首页</a>
<c:choose>
<c:when test="${page == 1}">上一页</c:when>
<c:otherwise>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${page-1}&username=<%=user.getRealName() %>">上一页</a>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page == 1 || page == 2 || page == 3 || page == 4}">
<c:if test="${maxPage <= 4}">
<c:forEach begin="1" end="${maxPage}" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:if>
<c:if test="${maxPage > 4}">
<c:forEach begin="1" end="5" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:if>
</c:when>
<c:when test="${page+2 < maxPage}">
<c:forEach begin="${page-2}" end="${page+2}" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach begin="${maxPage-4}" end="${maxPage}" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page == maxPage}">下一页</c:when>
<c:otherwise>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${page+1}&username=<%=user.getRealName() %>">下一页</a>
</c:otherwise>
</c:choose>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${maxPage}&username=<%=user.getRealName() %>">尾页</a>
<input type="text" id="pageId" value="${page }" style="width: 30px" />
<input type="button" value="跳转" οnclick="mySkip()" />
<input type="hidden" value="${maxPage }" id="maxId" />
</td>
</tr>
</table>
</c:otherwise>
</c:choose>
function mySkip(){
//var page = document.getElementById("pageId").value ;
var page = parseInt($("#pageId").val()) ;
var maxPage = $("#maxId").val() ;
var re = new RegExp("[0-9]") ;
alert(page) ;
alert(re.test(page)) ;
if(page > 0 && page <= maxPage){
location = "<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&username=<%=user.getRealName() %>&page="+page ;
}else{
alert("无效页数!!!") ;
}
}
取整数问题
1.丢弃小数部分,保留整数部分
parseInt(5/2)
2.向上取整,有小数就整数部分加1
Math.ceil(5/2)
3,四舍五入.
Math.round(5/2)
4,向下取整
Math.floor(5/2)
<c:when test="${maxPage == 0}">
<div align="center"><h3><font color="red">没有数据!!!!!</font></h3></div>
</c:when>
<c:otherwise>
<table width="100%" bgcolor="whitesmoke" border="0" align="center" cellpadding="2" cellspacing="2" class="list_bt">
<tr>
<td align="center">
总共【<font color="red">${maxPage}</font>】页 <font color="red">${page}</font>/<font color="red">${maxPage}</font>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=1&username=<%=user.getRealName() %>">首页</a>
<c:choose>
<c:when test="${page == 1}">上一页</c:when>
<c:otherwise>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${page-1}&username=<%=user.getRealName() %>">上一页</a>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page == 1 || page == 2 || page == 3 || page == 4}">
<c:if test="${maxPage <= 4}">
<c:forEach begin="1" end="${maxPage}" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:if>
<c:if test="${maxPage > 4}">
<c:forEach begin="1" end="5" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:if>
</c:when>
<c:when test="${page+2 < maxPage}">
<c:forEach begin="${page-2}" end="${page+2}" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach begin="${maxPage-4}" end="${maxPage}" var="i">
<c:if test="${page == i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="red">${i}</font></a>
</c:if>
<c:if test="${page != i}">
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${i }&username=<%=user.getRealName() %>"><font color="blue">${i}</font></a>
</c:if>
</c:forEach>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page == maxPage}">下一页</c:when>
<c:otherwise>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${page+1}&username=<%=user.getRealName() %>">下一页</a>
</c:otherwise>
</c:choose>
<a href="<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&page=${maxPage}&username=<%=user.getRealName() %>">尾页</a>
<input type="text" id="pageId" value="${page }" style="width: 30px" />
<input type="button" value="跳转" οnclick="mySkip()" />
<input type="hidden" value="${maxPage }" id="maxId" />
</td>
</tr>
</table>
</c:otherwise>
</c:choose>
function mySkip(){
//var page = document.getElementById("pageId").value ;
var page = parseInt($("#pageId").val()) ;
var maxPage = $("#maxId").val() ;
var re = new RegExp("[0-9]") ;
alert(page) ;
alert(re.test(page)) ;
if(page > 0 && page <= maxPage){
location = "<%=basePath %>ApplyServlet?b=findAllFund&digit=3¶m=30&username=<%=user.getRealName() %>&page="+page ;
}else{
alert("无效页数!!!") ;
}
}
取整数问题
1.丢弃小数部分,保留整数部分
parseInt(5/2)
2.向上取整,有小数就整数部分加1
Math.ceil(5/2)
3,四舍五入.
Math.round(5/2)
4,向下取整
Math.floor(5/2)