⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menutopmovies.jsp

📁 一个用struts tiles的在线影院web系统
💻 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 element) {
	String result = "";
	for (int i = 0; i < count; i ++)
		result += element;
	return result;
}

%>
<%
int pageIndex = 0, pageSize = 10;
// 按最后访问数倒序获取影片列表
String cacheKey = "movies-top-" + pageIndex + "-" + pageSize;
Cache cache = Cache.getInstance();
Page chunk = (Page) cache.get(cacheKey);	// 尝试从cache中获取数据
if (chunk == null) {						// 如果失败则从数据库获取
	Movies movies = new Movies();
	MovieCondition condition = new MovieCondition();
	condition.setSortBy(MovieCondition.SortBy_AccessCount);
	chunk = movies.searchMovie(condition, pageIndex, pageSize);
	if (chunk.getItems().size() > 0) {		// 如果有数据则放入cache并设定1分钟超期
		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:TOP:BEGIN -->
<table cellSpacing="1" cellPadding="1" width="100%" border="0">
	<tr>
		<td><a href="<%=SiteUrls2.getInstance().getProperty("top") %>"><img alt="更多内容" border="0" src="<%= request.getContextPath() %>/images/banner-left_top.gif"></a></td>
	</tr>
	<tr>
		<td>
		<%if (isEmptySet) { %><%-- 如果数目为空 --%>
		<table class="body0" borderColor="#999999" cellSpacing="1" cellPadding="3" width="100%" bgColor="#f7f1e3" border="1">
			<tr>
				<td align="center">影片数为空!</td>
			</tr>
		</table>
		<%} else { %>
		<table class="body0" borderColor="#999999" cellSpacing="1"
			cellPadding="3" width="100%" bgColor="#f7f1e3" border="1">
			<tr>
			<%
			Movie firstItem = (Movie) chunk.getItems().get(0);
			%>
				<td vAlign="middle" align="center" width="76"><a href="<%=movieURL + firstItem.getIndexID() %>"><img alt="点击进入:<%=firstItem.getTitle() %>" border="0" src="<%= request.getContextPath() + ImageProcessor.getThumbFileURL(firstItem.getOrigionFile(), 75, 105) %>" width="75" height="105"></a></td>
				<td vAlign="top"><img src="<%= request.getContextPath() %>/images/num_1b.gif"><%=showStars(firstItem.getRecommend(), "<img src=\"" + request.getContextPath() + "/images/zhishu.gif\"  width=\"15\" height=\"13\"/>") %><br>
				<br>
				片名:<a href="<%=movieURL + firstItem.getIndexID() %>"><%=firstItem.getTitle() %></a><br>
				源名:<%=firstItem.getOriginName() %><br>
				导演:<%=firstItem.getDirector() %><br>
				编剧:<%=firstItem.getPlaywright() %><br>
				主演:<%=firstItem.getActors() %>
				</td>
			</tr>
			<% for (int i = 1; i < chunk.getItems().size(); i ++) {
				Movie item = (Movie) chunk.getItems().get(i);%>
			<tr>
				<td colSpan="2"><img src="<%= request.getContextPath() %>/images/num_<%=(i+1)%>.gif">&nbsp;&nbsp;<a href="<%=movieURL + item.getIndexID() %>"><%=item.getTitle() %></a></td>
			</tr>
			<%} %>
		</table>
		<%} %>
		</td>
	</tr>
	<tr>
		<td><img src="<%= request.getContextPath() %>/images/footer-left_common.gif"></td>
	</tr>
</table>
<!-- LEFT:TOP:END -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -