时间:2021-07-01 10:21:17 帮助过:3人阅读
pstmt.setInt(1, (inputPage - 1) * pageSize);
pstmt.setInt(2, pageSize);
主要jsp
<body>
  
  <ul>
    <c:forEach items="${requestScope.tests}" var="p">
      <li>用户名:${p.name}</li>
    </c:forEach>
  </ul>
  <c:if test="${param.cur == 1}">
    <a>首页</a>
    <a>上一页</a>
  </c:if>
  
  <c:if test="${param.cur != 1}">
    <a href="UserAction?cur=1">首页</a>
    <a href="UserAction?cur=${param.cur - 1}">上一页</a>
  </c:if>
  
  <c:if test="${param.cur == requestScope.totalPage}">
    <a>下一页</a>
    <a>尾页</a>
  </c:if>
  
  <c:if test="${param.cur != requestScope.totalPage}">
    <a href="UserAction?cur=${param.cur + 1}">下一页</a>
    <a href="UserAction?cur=${requestScope.totalPage}">尾页</a>
  </c:if>
  
  <p>
    当前第${param.cur}页       总共${requestScope.totalPage}页
  </p>
  
  </body>
 
 mysql 分页
标签: