问题描述
- 为什么下面的分页没有效果呢?
-
共${pageBean.allRow }条记录???
共${pageBean.totalPage }页???
当前第${pageBean.currentPage }页<c:choose> <c:when test="${pageBean.currentPage == 1}"> 首页 上一页 </c:when> <c:otherwise> <a href="/xiaoneinew/article.do?flag=showArticleUI&page=1">首页</a> <a href="/xiaoneinew/article.do?flag=showArticleUI&page=${pageBean.currentPage - 1 }">上一页</a> </c:otherwise> </c:choose> <c:choose> <c:when test="${pageBean.currentPage != pageBean.totalPage}"> <a href="/xiaoneinew/article.do?flag=showArticleUI&page=${pageBean.currentPage + 1 }">下一页</a> <a href="/xiaoneinew/article.do?flag=showArticleUI&page=${pageBean.totalPage }">末页</a> </c:when> <c:otherwise> 下一页 末页 </c:otherwise> </c:choose> </td> </tr>
点击下一页、上一页没有效果。
解决方案
action代码:
public ActionForward showArticleUI(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//得到当前用户[从session取出]
Users loginUser = (Users) request.getSession().getAttribute("loginuser");
this.pageBean = articleService.queryForPage(loginUser.getId(), 8, page);
this.listArticle = this.pageBean.getList();
request.setAttribute("pageBean", pageBean);
request.setAttribute("listArticle", listArticle);
//System.out.println(pageBean);
return mapping.findForward("goShowArticleUI");
}
解决方案二:
page=${pageBean.currentPage - 1 }">上一页
你的当前页是用page表示么?
currentPage = ¥{pageBean.currentPage-1}
时间: 2024-10-30 02:26:04