这是rollpage.jsp代码<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css"></style>
</head>
<body>
  <div class="page-bar">
<ul class="page-num-ul clearfix">
<li>共${page.totalNum }条记录&nbsp;&nbsp; ${page.currentPage }/${page.totalPage }页</li>
<c:if test="${page.currentPage > 1}">
<a href="javascript:page_nav(document.forms[0],1);">首页</a>
<a href="javascript:page_nav(document.forms[0],${page.currentPage-1});">上一页</a>
</c:if>
<c:if test="${page.currentPage < page.totalPage }">
<a href="javascript:page_nav(document.forms[0],${page.currentPage+1 });">下一页</a>
<a href="javascript:page_nav(document.forms[0],${page.totalPage });">最后一页</a>
</c:if> 
&nbsp;&nbsp;
</ul>
 <span class="page-go-form"><label>跳转至</label>
     <input type="text" name="inputPage" id="inputPage" class="page-key" value=" ${page.currentPage }"/>页
     <button type="button" class="page-btn" onClick='jump_to(document.forms[0],document.getElementById("inputPage").value)'>GO</button>
</span>

</div> 

</body>
<script type="text/javascript" src="${pageContext.request.contextPath }/statics/js/rollpage.js"></script>
</html>rollpage.js代码如下:
function page_nav(frm,num){
frm.pageIndex.value = num;
frm.submit();
}function jump_to(frm,num){
    //alert(num);
//验证用户的输入
var regexp=/^[1-9]\d*$/;
var totalPageCount = document.getElementById("totalPageCount").value;
//alert(totalPageCount);
if(!regexp.test(num)){
alert("请输入大于0的正整数!");
return false;
}else if((num-totalPageCount) > 0){
alert("请输入小于总页数的页码");
return false;
}else{
page_nav(frm,num);
}
}
这是在一个书籍展示界面引用分页的jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%-- <%@include file="./common/head.jsp"%> --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>  <body>
    <div class="right">
       <div class="location">
           <strong>你现在所在的位置是:</strong>
           <span>书籍列表</span>
       </div>
       <div>
       <form method="get" action="${pageContext.request.contextPath }/book/findAll">
<!-- <input name="method" value="query" class="input-text" type="hidden">  -->

<span>书籍名称:</span>
<input  name="queryBookName" type="text" value="${queryBookName }">
<span>书籍作者:</span>
<input  name="queryBookAuthor" type="text" value="${queryBookAuthor }">
<!-- <input type="hidden" name="pageIndex" value="1"/>  -->

<span>书籍类别:</span>
 <select name="className">
<c:if test="${classList != null }">
   <option value="0">--请选择--</option>
   <c:forEach var="bookclass" items="${classList}">
    <option <c:if test="${bookclass.cid == className }">selected="selected"</c:if>
    value="${bookclass.cid}">${bookclass.cname}</option>
   </c:forEach>
</c:if>
         </select>  <input value="查 询" type="submit" id="searchbutton">
</form>
       </div> 
       
      <table class="booksTable" cellpadding="0" cellspacing="0">
          <tr class="firstTr">
             <th width="10%">书籍编号</th>
              <th width="10%">书籍名称</th>
              <th width="10%">书籍作者</th>
              <th width="10%">书籍类别</th>
              <th width="5%">ISBN</th>
              <th width="5%">出版社</th>
              <th width="10%">出版日期</th>
              <th width="10%">库存</th>
              <th width="10%">价格</th>
              <th width="20%">操作</th>
          </tr>
          <c:forEach var="book" items="${bookList}" varStatus="status">
<tr>
<td>
<span>${book.book_id}</span>
</td>
<td>
<span>${book.name}</span>
</td>
<td>
<span>${book.author}</span>
</td>
<td>
<span>${book.cname}</span>
</td>
<td>
<span>${book.book_num}</span>
</td>
<td>
<span>${book.publish}</span>
</td>
<td>
<span>${book.pubdate}</span>
</td>
<td>
<span>${book.stock}</span>
</td>
<td>
<span>${book.price}</span>
</td>
<td>
<span><a class="viewBook" href="javascript:;" bookid=${book.book_id } bookname=${book.name }><img src="${pageContext.request.contextPath }/statics/images/read.png" alt="查看" title="查看"/></a></span>

<span><a class="modifyBook" href="javascript:;" bookid=${book.book_id } bookname=${book.name }><img src="${pageContext.request.contextPath }/statics/images/xiugai.png" alt="修改" title="修改"/></a></span>

<span><a class="deleteBook" href="javascript:;" bookid=${book.book_id } bookname=${book.name }><img src="${pageContext.request.contextPath }/statics/images/schu.png" alt="删除" title="删除"/></a></span>
</td>
</tr>
</c:forEach>
      </table>
      <input type="hidden" id="totalPageCount" value="${page.totalPage}"/>
      <input type="hidden" id="currentPageCount" value="${page.currentPage}"/>
  <c:import url="rollpage.jsp">
           <c:param name="totalCount" value="${page.totalNum}"/>
           <c:param name="currentPageNo" value="${page.currentPage}"/>
           <c:param name="totalPageCount" value="${page.totalPage}"/>
      </c:import>
  </div>
  
  
  <input type="hidden" id="path" name="path" value="${pageContext.request.contextPath }"/>
  <input type="hidden" id="referer" name="referer" value="<%=request.getHeader("Referer")%>"/>
  <%@include file="./common/foot.jsp" %>
  <script type="text/javascript" src="${pageContext.request.contextPath }/statics/js/booklist.js"></script>
  </body>
</html>