📄 bodygrouppager.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030" import="com.eline.vod.utils.*,com.blue.web.common.util.*,java.util.*,com.eline.vod.utils.caching.*,com.blue.web.common.model.*,com.eline.vod.client.*,com.eline.vod.model.*"%>
<%
int pageIndex = StringUtils.getInt(request.getParameter("page"), 0);
int groupId = StringUtils.getInt(request.getParameter("group"), 0);
Cache cache = Cache.getInstance();
String moviesCacheKey = "movies-group:" + groupId + "-8-" + pageIndex;
Page chunk = (Page) cache.get(moviesCacheKey);
if (chunk == null) {
MovieCondition condition = new MovieCondition();
condition.setSortBy(MovieCondition.SortBy_LastUpdate);
chunk = Groups.searchMovie(null, groupId, pageIndex * 8, 8);
if (chunk.getItems().size() > 0) {
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MINUTE, 5);
cache.add(moviesCacheKey, chunk, cal.getTime(), Cache.NoSlidingExpiration);
}
}
int totalPage = (chunk.getTotalRecords() + 7) / 8 ;
String groupURL = SiteUrls2.getInstance().getMovieGroupURL() + "?group=" + groupId;
String sortBy = request.getParameter("sort");
if (sortBy != null)
groupURL += "&sort=" + sortBy;
%>
<table width="100%" height="38" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8"><img src="<%= request.getContextPath() %>/images/pager-left.gif" /></td>
<td align="center" background="<%= request.getContextPath() %>/images/pager-bg.gif">
<table border="0" cellspacing="0" cellpadding="0" class="pager1">
<tr>
<td>
<div align="center"><a href="<%=groupURL %>">首页</a><%
if (pageIndex > 0) {
%> <a href="<%=groupURL + "&page=" + (pageIndex-1) %>">上一页</a><%
}
for (int i = 0; i < totalPage; i ++) {
%> | <a href="<%=groupURL + "&page=" + i %>"><%=(i+1) %></a><%
}%> |<%
if (pageIndex < (totalPage - 1)) {
%> <a href="<%=groupURL + "&page=" + (pageIndex+1) %>">下一页</a><%}
%> <a href="<%=groupURL + "&page=" + (totalPage-1)%>">尾页</a></div>
</td>
<td></td>
</tr>
</table>
</td>
<td width="8"><img src="<%= request.getContextPath() %>/images/pager-right.gif" /></td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -