📄 movie_list.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>欢迎光临在线视频播放系统</title>
<link rel=stylesheet type=text/css href="./lib/movie.css">
<jsp:useBean scope="page" id="Movie" class="com.chapter13.Movie" />
<jsp:useBean scope="page" id="Page" class="com.chapter13.SplitPage" />
</head>
<body>
<div align="center"><br>
<table width="95%" border="0">
<%
//获取表示某类影片信息的参数值
String sSort = request.getParameter("Sort");
//对字符串进行编码
sSort = new String(sSort.getBytes("iso8859_1"));
//获取某类影片信息
Movie.setSort(sSort);
ResultSet rs = Movie.show_sort_movies();
//初始化分页显示类,每页显示10条记录
Page.initialize(rs,10);
//获取当前所要显示的页数
String strPage=null;
int showPage = 1;
//获取跳转到的目的页面
strPage=request.getParameter("showPage");
if (strPage==null)
showPage=1;
else
{
try
{
showPage=Integer.parseInt(strPage);
}
catch(NumberFormatException e)
{
showPage = 1;
}
if(showPage<1)
showPage=1;
if(showPage>Page.getPageCount())
showPage=Page.getPageCount();
}
//获取要显示的数据集合
Vector vData=Page.getPage(showPage);
int i = 0 ;
for(i=0;i<vData.size();i++)
{
String[] sData=(String[])vData.get(i);
%>
<tr>
<td width="50%">
<table width="98%" border="1" cellpadding="0" cellspacing="0">
<tr><td rowspan="6" align="center"><a href='movie_detail.jsp?MovieID=<%=sData[0]%>' target="_self" ><img src='./pic/<%=sData[6]%>' border="0"></a></td>
<td height="25" align="left"> 名称:<font color="#0000FF"><%=sData[1]%></font></td></tr>
<tr><td height="25" align="left"> 类型:<font color="#0000FF"><%=sData[2]%></font></td></tr>
<tr><td height="25" align="left"> 语言:<font color="#0000FF"><%=sData[3]%></font></td></tr>
<tr><td height="25" align="left"> 产地:<font color="#0000FF"><%=sData[4]%></font></td></tr>
<tr><td height="25" align="left"> 点击数:<font color="#0000FF"><%=sData[8]%></font></td></tr>
<tr><td height="25" align="left"> 上传时间:<font color="#0000FF"><%=sData[7]%></font></td></tr>
</table>
</td>
<%
i++;
if(i<vData.size())
{
sData=(String[])vData.get(i);
%>
<td width="50%">
<table width="98%" border="1" cellpadding="0" cellspacing="0">
<tr><td rowspan="6"><a href='movie_detail.jsp?MovieID=<%=sData[0]%>' target="_self"><img src='./pic/<%=sData[6]%>' border="0"></a></td>
<td height="25" align="left"> 名称:<font color="#0000FF"><%=sData[1]%></font></td></tr>
<tr><td height="25" align="left"> 类型:<font color="#0000FF"><%=sData[2]%></font></td></tr>
<tr><td height="25" align="left"> 语言:<font color="#0000FF"><%=sData[3]%></font></td></tr>
<tr><td height="25" align="left"> 产地:<font color="#0000FF"><%=sData[4]%></font></td></tr>
<tr><td height="25" align="left"> 点击数:<font color="#0000FF"><%=sData[8]%></font></td></tr>
<tr><td height="25" align="left"> 上传时间:<font color="#0000FF"><%=sData[7]%></font></td></tr>
</table>
</td></tr>
<%
}
else
{
%>
<td width="50%"> </td></tr>
<%
break;
}
}
%>
</table>
<p>
第<font color="#FF0000"><%=showPage%></font>页/共<font color=red><%=Page.getPageCount()%></font>页
<a href="movie_list.jsp?showPage=1&Sort=<%=sSort%>" target="_self"><font color="#0000FF">[首页]</font></a>
<%
//判断"上一页"链接是否要显示
if(showPage > 1)
{
%>
<a href="movie_list.jsp?showPage=<%=showPage-1%>&Sort=<%=sSort%>" target="_self"><font color="#0000FF">[上一页]</font> </a>
<%
}
else
out.println("[上一页] ");
//判断"下一页"链接是否要显示
if(showPage < Page.getPageCount())
{
%>
<a href="movie_list.jsp?showPage=<%=showPage+1%>&Sort=<%=sSort%>" target="_self"><font color="#0000FF">[下一页]</font> </a>
<%
}
else
out.println("[下一页] ");
%>
<a href="movie_list.jsp?showPage=<%=Page.getPageCount()%>&Sort=<%=sSort%>" target="_self"><font color="#0000FF">[尾页]</font> </a>
</p>
<%rs.close();%>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -