📄 productlist.jsp~1~
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,eshop.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="pool" scope="application" class="eshop.PoolBean"/>
<jsp:useBean id="list" scope="session" class="eshop.ProductListBean"/>
<%
Connection conn=pool.getConnection();
list.reset();
list.setConn(conn);
%>
<jsp:setProperty name="list" property="*"/>
<%
list.storeItem();
int showPage=list.getShowPage();
int pageCount=list.getPageCount();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>浏览商品</title>
<link href="../css/product.css" rel="stylesheet" type="text/css">
</head>
<body>
<center>
<%
if(list.getPageNumber()==0){
out.print("对不起!没有此类商品!");
}else{
%>
<p>浏览商品(第<%= showPage %>页,共<%= pageCount %>页)</p>
<p>
<% if(showPage!=1) {%>
<a href="<%=request.getRequestURL()%>?pageIndex=1">首页</a>
<a href="<%=request.getRequestURL()%>?pageIndex=<%=showPage==1?showPage:showPage-1%>">上一页</a>
<%}%>
<% if(showPage!=pageCount) {%>
<a href="<%=request.getRequestURL()%>?pageIndex=<%=showPage==pageCount?showPage:showPage+1%>">下一页</a>
<a href="<%=request.getRequestURL()%>?pageIndex=<%=pageCount%>">末页</a>
<% } %>
</p>
<p><a href="../cart/cart.jsp">查看购物车/结算</a> </p>
<form action="" method="get" name="form1">
跳转到
<input name="showPage" type="text" id="showPage" size="5">
页
<input type="submit" name="Submit" value="跳转">
</form>
<table width="750" border="1" cellspacing="1" cellpadding="1">
<tr align="center">
<td>商品名称</td>
<td width="50">编码</td>
<td width="60">分类</td>
<td width="50">市场价</td>
<td width="50">现价</td>
<td width="150">图片</td>
<td> </td>
<td> </td>
</tr>
<%
for(int i=0;i<list.getPageNumber();i++){
Product prod=list.getItem(i);
%>
<tr>
<td><%= prod.productName %> </td>
<td><%= prod.coding %> </td>
<td><%= prod.categoryID %> </td>
<td><font class="lineThrough"><%= prod.marketPrice %></font> </td>
<td><%= prod.price %> </td>
<td><%= prod.picture %> </td>
<td> <a href="productDetail.jsp?productID=<%= prod.productID %>" target="_blank">详情</a></td>
<td><a href="../cart/addItem.jsp?productID=<%= prod.productID %>" target="_blank">购买</a></td>
</tr>
<%
}
%>
</table>
<%
}
pool.releaseConnection(conn);
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -