江西广告网

标题: opencms分页示例 [打印本页]

作者: yxwz800    时间: 2009-2-17 10:58
标题: opencms分页示例
列表页 list.jsp: <pg:pager items="<%= totalNum %>" index="center" maxPageItems="<%= pageSize %>" maxIndexPages="<%= maxIndexPages %>" isOffset="false" export="offset,currentPageNumber=pageNumber" scope="request"> <pg:index> <pg:first export="pageUrl,pageNumber" unless="current"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">|<</a> </pg:first> <pg:skip export="pageUrl,pageNumber" pages="<%= -maxIndexPages %>"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>"><<<</a> </pg:skip> <pg:prev export="pageUrl,pageNumber"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>"><<</a> </pg:prev> <pg:pages> <% if (pageNumber == currentPageNumber) { %> <b><%= pageNumber %></b> <% } else { %> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>"><%= pageNumber %></a> <% }%> </pg:pages> <pg:next export="pageUrl,pageNumber"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">>></a> </pg:next> <pg:skip export="pageUrl,pageNumber" pages="<%= maxIndexPages %>"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">>>></a> </pg:skip> <pg:last export="pageUrl,pageNumber " unless="current"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">>|</a> </pg:last> </pg:index> </pg:pager> <pg:pager items="<%= totalNum %>" index="center" maxPageItems="<%= pageSize %>" maxIndexPages="<%= maxIndexPages %>" isOffset="false" export="offset,currentPageNumber=pageNumber" scope="request"> <pg:index> <pg:first export="pageUrl,pageNumber" unless="current"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">|<</a> </pg:first> <pg:skip export="pageUrl,pageNumber" pages="<%= -maxIndexPages %>"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>"><<<</a> </pg:skip> <pg:prev export="pageUrl,pageNumber"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>"><<</a> </pg:prev> <pg:pages> <% if (pageNumber == currentPageNumber) { %> <b><%= pageNumber %></b> <% } else { %> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>"><%= pageNumber %></a> <% }%> </pg:pages> <pg:next export="pageUrl,pageNumber"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">>></a> </pg:next> <pg:skip export="pageUrl,pageNumber" pages="<%= maxIndexPages %>"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">>>></a> </pg:skip> <pg:last export="pageUrl,pageNumber " unless="current"> <a href="<%= pageUrl %>&pageIndex=<%= pageNumber %>">>|</a> </pg:last> </pg:index> </pg:pager> [1] [2] 分页导航页 page.jsp <%@ page import="java.text.SimpleDateFormat,java.util.Date,org.opencms.jsp.CmsContentInfoBean"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms"%> <%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %> <html> <head> <title>文档列表页测试</title> <cms:editable/> </head> <body> <% int totalNum = 0; int maxIndexPages = 3; int pageSize = 2; int pageIndex = request.getParameter("pageIndex") == null ? 1 : Integer.parseInt(request.getParameter("pageIndex")); pageContext.setAttribute("pageSize", pageSize); pageContext.setAttribute("pageIndex", pageIndex); %> <cms:contentload collector="allInFolderPriorityDateDesc" param="/opensource/dev/01/%(number).html|doc" editable="true" pageSize="%(pageContext.pageSize)" pageIndex="%(pageContext.pageIndex)"> <a href="<cms:link><cms:contentshow element="%(opencms.filename)" /></cms:link>" target="_blank"> <cms:contentshow element="Title" /> </a> <c:set var="strDate"><cms:contentshow element="Date" /></c:set> <cms:contentinfo var="contentInfo" scope="request" /> <% long longDate = Long.valueOf(pageContext.getAttribute("strDate").toString()).longValue(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String createdDate = sdf.format(new Date(longDate)); out.print(createdDate); CmsContentInfoBean info = (CmsContentInfoBean)request.getAttribute("contentInfo"); totalNum = info.getResultSize(); %> <br /> </cms:contentload> <%@ include file="page.jsp" %> </body> </html> 上一页 [1] [2]




欢迎光临 江西广告网 (http://bbs.jxadw.com/) Powered by Discuz! X3.2