📄 menuhotmovies.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030" import="java.util.*,com.eline.vod.utils.caching.*,com.blue.web.common.model.*,com.eline.vod.utils.*,com.eline.vod.client.*,com.eline.vod.model.*" %>
<%!
/* 获取影片简介信息的索引 */
String adjustIntroLength(String str, int length) {
if (str == null)
return "不错的电影";
if (str.length() <= length)
return str;
return str.substring(0, length) + "...";
}
String showStars(int count) {
String result = "";
for (int i = 0; i < count; i ++)
result += "★";
return result;
}
%><%
String cacheKey = "movies-hot-0-12";
Cache cache = Cache.getInstance();
Page chunk = (Page) cache.get(cacheKey);
if (chunk == null) {
Movies movies = new Movies();
chunk = movies.searchHotMovie(null, 0, 12);
if (chunk.getItems().size() > 0) {
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MINUTE, 5);
cache.add(cacheKey, chunk, cal.getTime(), Cache.NoSlidingExpiration);
}
}
// 判断影片数目是否为0
boolean isEmptySet = chunk.getItems().size() < 1;
String movieURL = SiteUrls2.getInstance().getMovieURL() + "?item=";
%>
<!-- LEFT:HOT:BEGIN -->
<table cellSpacing="1" cellPadding="1" width="100%" border="0">
<tr>
<td><a href="<%=SiteUrls2.getInstance().getProperty("hot") %>"><img border="0" alt="更多内容" src="<%= request.getContextPath() %>/images/banner-left_hot.gif"></a></td>
</tr>
<tr>
<td>
<%if (isEmptySet) { %><%-- 如果数目为空 --%>
<table class="body0" cellSpacing="1" cellPadding="3" width="100%" border="0">
<tr>
<td align="center">影片数为空!</td>
</tr>
</table>
<%} else { %>
<table class="body0" cellSpacing="1" cellPadding="3" width="100%" border="0">
<%int i;
for (i = 0; i < 2 && i < chunk.getItems().size(); i ++) {
Movie item = (Movie) chunk.getItems().get(i);%>
<tr>
<td width="75"><a href="<%=movieURL + item.getIndexID() %>"><img alt="点击进入:<%=item.getTitle() %>" border="0" src="<%= request.getContextPath() + ImageProcessor.getThumbFileURL(item.getOrigionFile(), 75, 105) %>"></a></td>
<td vAlign="top">《<a href="<%=movieURL + item.getIndexID() %>"><%=item.getTitle() %></a>》<br>
简介:<%=adjustIntroLength(item.getIntro(), 25) %><br>
<br>
推荐:<%=showStars(item.getRecommend()) %></td>
</tr>
<% } %>
</table>
<table class="body0" borderColor="#ffffff" cellPadding="2" width="220"
bgColor="#f7f1e3" border="1">
<%for (int j = 0; i < chunk.getItems().size(); i ++, j++) {
Movie item = (Movie) chunk.getItems().get(i);
if (j % 2 == 0) {%>
<tr>
<%} %>
<td width="50%">《<a href="<%=movieURL + item.getIndexID() %>"><%=item.getTitle() %></a>》</td>
<%if (j % 2 == 1) { %>
</tr>
<%} %>
<%} %>
</table>
<%} %>
</td>
</tr>
<tr>
<td><img src="<%= request.getContextPath() %>/images/footer-left_common.gif"></td>
</tr>
</table>
<!-- LEFT:HOT:END -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -