jstl 实现分页效果
2016-09-13 15:18
218 查看
代码部分
<div class="pagination center">
<b>共${page.pageCount}页</b>
<c:choose>
<c:when test="${page.currentPage+1 == 1}">
<a class="navlinks current">首页 </a>
<a class="pagebtn" style="font-size: 12px;color: #454545;background-color: #eee;font-weight: 600;text-transform: uppercase;padding: 7px 10px;border-radius: 3px;margin-left: 5px;margin-right:5px;"><上一页 </a>
</c:when>
<c:otherwise>
<a href='${pageContent.request.contextPath}/news?currentPage=0&type=${page.type}' class="navlinks">首页 </a>
<a href='${pageContent.request.contextPath}/news?currentPage=${page.currentPage-1}&type=${page.type}' class="navlinks pagebtn"style="margin-left: 5px;margin-right:5px"><上一页 </a>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page.pageCount+1 <= 5}">
<c:forEach begin="1" end="${page.pageCount}" varStatus="s">
<c:choose>
<c:when test="${s.index == page.currentPage+1}">
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks current">${s.index}</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks">${s.index}</a>
</c:otherwise>
</c:choose>
</c:forEach>
</c:when>
<c:otherwise>
<c:choose>
<c:when test="${page.currentPage+1-1 > 2}">
<c:choose>
<c:when test="${page.currentPage+3 >= page.pageCount}">
<c:forEach begin="${page.pageCount-4}" end="${page.pageCount}" varStatus="s">
<c:choose>
<c:when test="${s.index == page.currentPage+1}">
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks current">${s.index}</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks">${s.index}</a>
</c:otherwise>
</c:choose>
</c:forEach>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage-2}&type=${page.type}" class="navlinks">${page.currentPage+1-2}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage-1}&type=${page.type}" class="navlinks">${page.currentPage+1-1}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage}&type=${page.type}" class="navlinks current">${page.currentPage+1}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage+1}&type=${page.type}" class="navlinks">${page.currentPage+1+1}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage+1+1}&type=${page.type}" class="navlinks">${page.currentPage+1+2}</a>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:forEach end="5" begin="1" varStatus="s">
<c:choose>
<c:when test="${s.index == page.currentPage+1}">
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks current">${s.index}</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks">${s.index}</a>
</c:otherwise>
</c:choose>
</c:forEach>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page.currentPage+1 == page.pageCount}">
<a class="pagebtn"style="font-size: 12px;color: #454545;background-color: #eee;font-weight: 600;text-transform: uppercase;padding: 7px 10px;border-radius: 3px;"> 下一页></a>
<a class="navlinks current"> 末页</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage+1}&type=${page.type}" class="navlinks pagebtn"> 下一页></a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.pageCount-1}&type=${page.type}" class="navlinks"> 末页</a>
</c:otherwise>
</c:choose>
</div>
效果实现
<div class="pagination center">
<b>共${page.pageCount}页</b>
<c:choose>
<c:when test="${page.currentPage+1 == 1}">
<a class="navlinks current">首页 </a>
<a class="pagebtn" style="font-size: 12px;color: #454545;background-color: #eee;font-weight: 600;text-transform: uppercase;padding: 7px 10px;border-radius: 3px;margin-left: 5px;margin-right:5px;"><上一页 </a>
</c:when>
<c:otherwise>
<a href='${pageContent.request.contextPath}/news?currentPage=0&type=${page.type}' class="navlinks">首页 </a>
<a href='${pageContent.request.contextPath}/news?currentPage=${page.currentPage-1}&type=${page.type}' class="navlinks pagebtn"style="margin-left: 5px;margin-right:5px"><上一页 </a>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page.pageCount+1 <= 5}">
<c:forEach begin="1" end="${page.pageCount}" varStatus="s">
<c:choose>
<c:when test="${s.index == page.currentPage+1}">
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks current">${s.index}</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks">${s.index}</a>
</c:otherwise>
</c:choose>
</c:forEach>
</c:when>
<c:otherwise>
<c:choose>
<c:when test="${page.currentPage+1-1 > 2}">
<c:choose>
<c:when test="${page.currentPage+3 >= page.pageCount}">
<c:forEach begin="${page.pageCount-4}" end="${page.pageCount}" varStatus="s">
<c:choose>
<c:when test="${s.index == page.currentPage+1}">
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks current">${s.index}</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks">${s.index}</a>
</c:otherwise>
</c:choose>
</c:forEach>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage-2}&type=${page.type}" class="navlinks">${page.currentPage+1-2}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage-1}&type=${page.type}" class="navlinks">${page.currentPage+1-1}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage}&type=${page.type}" class="navlinks current">${page.currentPage+1}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage+1}&type=${page.type}" class="navlinks">${page.currentPage+1+1}</a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage+1+1}&type=${page.type}" class="navlinks">${page.currentPage+1+2}</a>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:forEach end="5" begin="1" varStatus="s">
<c:choose>
<c:when test="${s.index == page.currentPage+1}">
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks current">${s.index}</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${s.index-1}&type=${page.type}" class="navlinks">${s.index}</a>
</c:otherwise>
</c:choose>
</c:forEach>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${page.currentPage+1 == page.pageCount}">
<a class="pagebtn"style="font-size: 12px;color: #454545;background-color: #eee;font-weight: 600;text-transform: uppercase;padding: 7px 10px;border-radius: 3px;"> 下一页></a>
<a class="navlinks current"> 末页</a>
</c:when>
<c:otherwise>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.currentPage+1}&type=${page.type}" class="navlinks pagebtn"> 下一页></a>
<a href="${pageContent.request.contextPath}/news?currentPage=${page.pageCount-1}&type=${page.type}" class="navlinks"> 末页</a>
</c:otherwise>
</c:choose>
</div>
效果实现
相关文章推荐
- .NET中使用datagrid实现的简单分页效果
- Flash中调用XML程序实现分页效果
- asp.net实现分页效果
- asp+ajax实现分页效果
- asp+ajax实现分页效果
- .NET中使用datagrid实现的简单分页效果
- asp复制到word实现分页效果
- 用AjaxPro实现无刷新翻页效果及数据库分页技术介绍
- 用AjaxPro实现无刷新翻页效果及数据库分页技术介绍
- 存储过程实现分页显示效果(转至http://www.knowsky.com/344199.html)
- 用JSTL的实现简单分页
- ASP实现分页和翻页的效果
- DataList分页技术-- PagedDataSource类实现DataList和Repeater的分页效果
- 用AjaxPro实现无刷新翻页效果及数据库分页技术介绍
- 用AjaxPro实现无刷新翻页效果及数据库分页技术介绍
- 一个完全用JSTL实现的JSP分页方案
- 简单的分页效果(servlet实现)
- [php]实现像GOOGLE一样分页效果的代码
- asp+ajax实现分页效果
- 当前页居中分页效果的JS实现