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

📄 bodysearchpaged.jsp

📁 一个用struts tiles的在线影院web系统
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GB18030"    pageEncoding="GB18030" import="com.blue.web.common.model.*,com.eline.vod.utils.*,com.eline.vod.client.*,com.eline.vod.model.*,com.blue.web.common.util.*"%>
<%
//确定关键字
String key = request.getParameter("key");
key = new String(((key == null) ? "" : key).getBytes("ISO-8859-1"), "GB18030");

//确定页码
int pageIndex = 0, pageSize = 12;
int totalPage = 0;
pageIndex = StringUtils.getInt(request.getParameter("page"), 0);
String pageURL = SiteUrls2.getInstance().getProperty("search") + "?key=" + java.net.URLEncoder.encode(key, "GB18030");
System.out.println("pageURL=" + pageURL);
// 获取当前页面内容数据
Page chunk = null;
if (key != null && key.length() > 0) {
	Movies movies = new Movies();
	MovieCondition condition = new MovieCondition();
	condition.setTitle(key);
	chunk = movies.searchMovie(condition, pageIndex, pageSize);
	totalPage = (chunk.getTotalRecords() + (pageSize) - 1) / pageSize;
} else {
	chunk = new Page();
}
// Is the result empty?
boolean isEmptySet = chunk.getItems().size() < 1;

%><!-- bodySearch.jsp -->
<table cellSpacing="1" cellPadding="1" width="100%" border="0">
	<tr>
		<td align="right">&nbsp;<b>请输入影片名:</b></td>
		<td align="right" width="370"><form style="MARGIN: 0px 0px 0px 0px" action="" method="GET"><input size="50" maxLength="250" type="text" name="key" value="<%=key %>" /><input type="submit" value="搜索" style="width: 50px"/></form></td>
	</tr>
</table>
<table cellSpacing="0" cellPadding="1" width="100%" border="0">
	<tr>
		<td>
		<table cellSpacing="0" cellPadding="0" width="100%" border="0" class="pager1">
			<tr>
				<td width="50" valign="bottom"><img src="<%= request.getContextPath() %>/images/01/title-right-hot-01.gif"></td>
				<td style="PADDING-TOP: 15px; FONT-WEIGHT: bold; COLOR: #ffffff" width="100"
					background="<%= request.getContextPath() %>/images/02/title-right-hot-bg.gif">&nbsp;搜索结果</td>
				<td width="5"><img src="<%= request.getContextPath() %>/images/02/title-right-hot-02.gif"></td>
				<td style="PADDING-TOP: 15px" align="right" background="<%= request.getContextPath() %>/images/02/title-right-hot-bg1.gif">&nbsp;</td>
				<td width="20"><img src="<%= request.getContextPath() %>/images/02/title-right-hot-03.gif"></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<table  bgcolor="#FFAD33" class="body4" style="BORDER: #F7F1E3 1px solid;" cellSpacing="0" cellPadding="3" width="100%" border="0">
<%if (isEmptySet) {
         %>
<%-- 如果数目为空 --%>
	<tr>
		<td align="center">
			抱歉,没找到您要查找的影片!
		</td>
	</tr>
<%} else {%>
	<%for (int i = 0; i < chunk.getItems().size(); i++) {
		Movie item = (Movie) chunk.getItems().get(i);
		String movieURL = SiteUrls2.getInstance().getMovieURL() + "?item=" + item.getIndexID();
		if (i % 3 == 0) {%>
	<tr>
		<%}
                 %>
		<td vAlign="top" width="17%">
			<a href="<%=movieURL %>"><img alt="点击进入:<%=item.getTitle() %>" class="imgBorder0" src="<%= request.getContextPath() + ImageProcessor.getThumbFileURL(item.getOrigionFile(), 100, 143)%>" width="100" height="143"></a>
		</td>
		<td vAlign="top" width="17%">
			<!-- 片名:-->
			<a href="<%=movieURL %>"><%=item.getTitle()%></a>
			<br>
			译名:
			<%=item.getOriginName()%>
			<br>
			导演:
			<%=item.getDirector()%>
			<br>
			编剧:
			<%=item.getPlaywright()%>
			<br>
			主演:
			<%=item.getActors()%>
		</td>
		<%if (i % 3 == 2) {%>
	</tr>
	<%}%>
	<%}%>
</table><span style="font-size: 1px">&nbsp;</span><br/>
<!--页码链接处理开始-->
<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="<%=pageURL %>">首页</a>
							<%
if (pageIndex > 0) {
							%>
							&nbsp;<a href="<%=pageURL + "&page=" + (pageIndex-1) %>">上一页</a>
							<%
}
               	int n1 = 0;
                for (int i = 0; i < totalPage; i++) {
%><%if (i < 3 || (i > (pageIndex-2) && i < (pageIndex + 2)) || i > (totalPage-4)) {
	if (pageIndex == i)	{	n1 = 0;%>&nbsp;|&nbsp;<b><%=(i + 1)%></b><%}else{ %>&nbsp;|&nbsp;<a href="<%=pageURL + "&page=" + i %>"><%=(i + 1)%></a><%}} else {
	if (n1++ < 3) {
		if (n1 == 1){%>&nbsp;|&nbsp;<%}%>.<%}}}%>&nbsp;|<%
if (pageIndex < (totalPage - 1)) {
                    %>
							&nbsp;<a href="<%=pageURL + "&page=" + (pageIndex+1) %>">下一页</a>
							<%}%>
							&nbsp;<a href="<%=pageURL + "&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 + -