📄 listproduct.jsp
字号:
<%@ page contentType="text/html;charset=GBK" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ page import="cn.com.zzb.eshopping.model.*" %>
<%@ page import="cn.com.zzb.eshopping.model.sql.*"%>
<%@ page import="java.util.*"%>
<html>
<head>
<META http-equiv=Content-Type content="text/html;charset=GBK">
<link rel="stylesheet" href="include/CSS.CSS" type="text/css">
<title>我的购物车</title>
<body background="images/bg.gif">
<logic:present name="user">
<h4>欢迎 <bean:write name="user" property="userid"/>!</h4>
</logic:present>
<table width="620" border="1" align="center">
<tr>
<td colspan="7" align="center"><h4>产品展示</h4></td>
</tr>
<tr>
<td width="40">序号</td>
<td width="100">产品名称</td>
<td width="60">价格</td>
<td width="60">库存量</td>
<td width="180">产品描述</td>
<td width="100">产品类别</td>
<td width="80"> </td>
</tr>
<%
int count=1;
Product product = new SqlProduct();
User user = new SqlUser();
Set set = new HashSet();
ProductFactory pFactory = new SqlProductFactory();
List list = pFactory.listProducts();
if(!list.isEmpty())
{
count=1;
ListIterator iterator =list.listIterator();
while(iterator.hasNext())
{
Object[] row = (Object[])iterator.next();
product = (Product)row[0];
String kind_name = (String)row[1];
//Kind kind = (Kind)product.getKind();
out.println("<tr>");
out.println("<td>"+count+"</td>");
out.println("<td>"+product.getName()+"</td>");
out.println("<td>"+product.getPrice()+"</td>");
out.println("<td>"+product.getStocks()+"</td>");
out.println("<td>"+product.getDiscription()+"</td>");
out.println("<td>"+kind_name+"</td>");
out.println("<td><a href='/eshopping/shopCarAction.do?method=buyProduct&p_Id="+product.getId()+"'>加入购物车</a></td>");
out.println("</tr>");
count++;
}
}
%>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<center><html:link forward="index">返回首页</html:link> | <html:link forward="myShopCar">我的购物车</html:link></center>
</body>
</head>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -