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

📄 bodylovemovies.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 result = "";
	for (int i = 0; i < count; i ++)
		result += "★";
	return result;
}
%><%
int groupId = 2;
String cacheKey = "movies-group:" + groupId + "-0-6";
Cache cache = Cache.getInstance();
Page chunk = (Page) cache.get(cacheKey);	// 尝试从cache中获取数据
if (chunk == null) {						// 如果失败则从数据库获取
	chunk = Groups.searchMovie(null, groupId, 0, 6);
	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;
Movie firstItem = null;
String movieURL = SiteUrls2.getInstance().getMovieURL() + "?group=" + groupId + "&item=";
String groupURL = SiteUrls2.getInstance().getMovieGroupURL() + "?group=" + groupId;
if (!isEmptySet) {
	firstItem = (Movie) chunk.getItems().get(0);
}
%><table cellSpacing="0" cellPadding="1" width="100%" border="0">
	<tr>
		<td colSpan="4">
			<table cellSpacing="0" cellPadding="0" width="100%" border="0">
				<tr>
					<td width="50"><img src="<%= request.getContextPath() %>/images/01/title-right-soft-01.gif"></td>
					<td class="title0" width="100" background="<%= request.getContextPath() %>/images/01/title-right-hot-bg.gif">&nbsp;<a href="<%=groupURL %>">柔情时刻</a></td>
					<td width="5"><img src="<%= request.getContextPath() %>/images/01/title-right-hot-02.gif"></td>
					<td background="<%= request.getContextPath() %>/images/01/title-right-hot-bg1.gif">&nbsp;</td>
					<td width="90"><a href="<%=groupURL %>"><img alt="点击进入" border="0" src="<%= request.getContextPath() %>/images/01/title-right-hot-03.gif"></a></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
		<% if (isEmptySet) { %>
			<table class="body2" cellSpacing="0" cellPadding="0" width="100%" bgColor="#ffcc33" border="0">
				<tr><td align="center">影片数为空!</td></tr>
			</table>
		<% } else {%>
			<table class="body2" cellSpacing="0" cellPadding="0" width="100%" bgColor="#ffcc33" border="0">
				<tr>
					<td width="230" align="center">
						<!-- Image with frameborder:Start -->
						<table cellSpacing="1" cellPadding="4" bgColor="#e0dcdb" border="0">
							<tr>
								<td bgColor="#ffffff"><a href="<%= movieURL + firstItem.getIndexID() %>"><img alt="点击进入:<%=firstItem.getTitle() %>" border="0" height="297" src="<%= request.getContextPath() + ImageProcessor.getThumbFileURL(firstItem.getOrigionFile(), 206, 297) %>" width="206"></a></td>
							</tr>
						</table>
						<!-- Image with frameborder:End --></td>
					<td>
						<table cellSpacing="0" cellPadding="0" width="100%" border="0">
							<tr>
								<td>
									<table class="body2" cellSpacing="0" cellPadding="5" width="100%" border="0">
									<% for (int i = 1; i < chunk.getItems().size() && i < 4; i ++) {
										Movie item = (Movie) chunk.getItems().get(i);%>
										<tr>
											<td style="BORDER-BOTTOM: #ffffff 1px dashed" height="105"><a href="<%=movieURL + item.getIndexID() %>"><img alt="点击进入:<%=item.getTitle() %>" border="0" src="<%= request.getContextPath()  + ImageProcessor.getThumbFileURL(item.getOrigionFile(), 110, 90)%>" align="right" style="BORDER: #000000 1px solid"></a>
												<a href="<%=movieURL + item.getIndexID() %>"><%=item.getTitle() %></a><br>
												简介:<%=adjustIntroLength(item.getIntro(), 22)%><br>
												推荐:<%=showStars(item.getRecommend()) %></td>
										</tr>
									<%} %>
									</table>
								</td>
							</tr>
						</table>
					</td>
					<td width="1" bgColor="#f7f1e3">
						<div style="FONT-SIZE: 0px"></div>
					</td>
					<td vAlign="bottom" width="25%">
						<!-- content here -->
						<table cellSpacing="0" cellPadding="0" width="100%" border="0">
							<tr>
								<td style="BORDER-BOTTOM: #ffffff 1px dashed">&nbsp;</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#ffcc33" height="25"><a href="<%=movieURL + firstItem.getIndexID() %>"><%=firstItem.getTitle() %></a></td>
					<td bgColor="#ffcc33" colSpan="3" height="25">&nbsp;</td>
				</tr>
			</table>
		<% } %>
		</td>
	</tr>
</table>

⌨️ 快捷键说明

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