注册
 找回密码
 注册
江西广告网
查看: 341|回复: 0
打印 上一主题 下一主题

opencms分页示例

[复制链接]

该用户从未签到

1
跳转到指定楼层
发表于 2009-2-17 10:58:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册

x
列表页 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]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表