CD列表cdlist.jsp
<!--<meta http-equiv="musiclist-Type" musiclist="text/html; charset=gb2312">-->
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %>
<%@ page import="cdshop.cd.cdclass" %>
<%@ page session="true" %>
<%@ page import="cdshop.cd.cd"%>
<%@ page import="cdshop.util.dataFormat"%>
<jsp:useBean id="cd" scope="page" class="cdshop.cd.cd" />
<jsp:useBean id="cd_list" scope="page" class="cdshop.run.op_cd" />
<jsp:useBean id="classlist" scope="page" class="cdshop.run.op_cdclass" />
<jsp:useBean id="user" scope="page" class="cdshop.run.op_user" />
<%
int pages=1;
String mesg = "";
if (request.getParameter("page")!=null && !request.getParameter("page").equals("")) {
String requestpage = request.getParameter("page");
try {
pages = Integer.parseInt(requestpage);
} catch(Exception e) {
mesg = "你要找的页码错误!";
}
cd_list.setPage(pages);
}
%>
<script language="javascript">
function openScript(url,name, width, height){
var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
</script>
<%@include file="inc/head.inc"%>
<%@include file="inc/sub.inc"%>
<table width="778" >
<tr>
<td width="150" align="center">
<%@include file="inc/left.inc"%>
</td>
<td width="600">
<p align="center"><b><font color="#0000FF">在线CD Shop CD<%= dataFormat.toString(classname) %>列表</font></b></p>
<%if (!keyword.equals("")) out.println("<p ><font color=#ff0000>你要查找关于" + keyword +"的CD如下</font></p>"); %>
<table width="100%" border="1" cellspacing="1" cellpadding="1" bordercolor="white">
<tr align="center" bgcolor="#DEF3CE">
<td>CD名称</td>
<td>歌手名</td>
<td>CD类别</td>
<td>发行唱片公司</td>
<td>单价</td>
<td>会员价</td>
<td width=110>选择</td>
</tr>
<% if (cd_list.cd_search(request)) {
if (cd_list.getcdlist().size()>0 ){
for (int i=0;i<cd_list.getcdlist().size();i++){
cd bk = (cd) cd_list.getcdlist().elementAt(i);%>
<tr>
<td><%= dataFormat.toString(bk.getcdName()) %></td>
<td align="center"><%= bk.getSinger() %></td>
<td align="center"><%=dataFormat.toString(bk.getClassname()) %></td>
<td align="center"><%= dataFormat.toString(bk.getPublish()) %></td>
<td align="center"><%= bk.getPrice() %>元</td>
<td align="center" ><font color=red><%= (((int)(10*(bk.getPrice()*user.getUserRate((String) session.getAttribute("userid"))))/10.0)) %>元</font></td>
<td align="center"><a href="#" onclick="openScript('buy.jsp?cdid=<%= bk.getId() %>','pur',300,250)" >购买</a>
<a href="#" onclick="openScript('detail.jsp?cdid=<%= bk.getId() %>','show',400,500)" >详细资料</a></td>
</tr>
<% }
}else {
if (keyword.equals("")){
out.println("<tr><td align='center' colspan=6> 暂时没有此类CD资料</td></tr>");
} else {
out.println("<tr><td align='center' colspan=6> 没有你要查找的 " + keyword + " 相关CD</td></tr>") ;
}
}
} else {%>
<tr>
<td align="center" colspan=6> 数据库出错,请稍后</td>
</tr>
<% } %>
</table>
<table width="90%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td align="right">总计结果为<%= cd_list.getRecordCount() %>条,当前页第<%= cd_list.getPage() %>页 <a href="cdlist.jsp?classid=<%= classid%>&keyword=<%= keyword %>">首页</a>
<% if (cd_list.getPage()>1) {%>
<a href="cdlist.jsp?page=<%= cd_list.getPage()-1 %>&classid=<%= classid%>&keyword=<%= keyword %>">上一页</a>
<% } %>
<% if (cd_list.getPage()<cd_list.getPageCount()-1) {%>
<a href="cdlist.jsp?page=<%= cd_list.getPage()+1 %>&classid=<%= classid%>&keyword=<%= keyword %>">下一页</a>
<% } %>
<a href="cdlist.jsp?page=<%= cd_list.getPageCount() %>&classid=<%= classid%>&keyword=<%= keyword %>">未页</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<%@include file="inc/tail.inc"%>