<%@ page language="java" pageEncoding="utf-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <c:if test="${pageView.totalPage gt 1 }"> <!-- 分页信息 --> 页码:${pageView.currentPage}/${pageView.totalPage}页 每页显示:${pageView.pageSize}条 总记录数:${pageView.recordCount}条 分页: <a href="javascript:gotoPage(1)">[首页]</a> <c:if test="${pageView.currentPage gt 1}"> <a href="javascript:gotoPage(${pageView.currentPage - 1})">[上一页]</a> </c:if> <c:if test="${pageView.currentPage lt pageView.totalPage}"> <a href="javascript:gotoPage(${pageView.currentPage + 1})">[下一页]</a> </c:if> <a href="javascript:gotoPage(${pageView.totalPage})">[尾页]</a> <!-- 显示页码 --> <c:forEach begin="${pageView.startPageIndex}" end="${pageView.endPageIndex}" var="pageNum"> <c:if test="${pageNum eq pageView.currentPage}"> <span class="current_page">${pageNum}</span> </c:if> <c:if test="${pageNum ne pageView.currentPage}"> <a href="javascript:gotoPage(${pageNum})">${pageNum}</a> </c:if> </c:forEach> 转到: <input type="text" id="txtPageNum" size="4" class="input_pagenum"/> <input type="button" onclick="gotoPage(document.getElementById('txtPageNum').value)" value="Go"/> <script type="text/javascript"> /** * 跳转到指定的页码 */ function gotoPage( pageNum ){ if( isNaN(pageNum) ){ // not a number alert("请输入正确的页码"); document.getElementById('txtPageNum').focus(); return false; } if( pageNum < 1 || pageNum > ${pageView.totalPage} ){ alert("请输入正确的页码,范围为 1-${pageView.totalPage}"); document.getElementById('txtPageNum').focus(); return false; } window.location.href = getPageViewUrl( pageNum ); // getPageViewUrl为在include页面添加的javscript代码, // 所以此页面可以适用于任何分页信息的显示。例如下: //function getPageViewUrl( pageNum ){ // return "?method=list&pageNum=" + pageNum; //} } </script> </c:if> |