📄 prouctinfo.jsp
字号:
<%@page contentType="text/html; charset=GB2312"%>
<%@include file="common.jsp"%>
<jsp:useBean id="cart" scope="session"
class="shop.CartBean"/>
<html>
<head><title>欢迎光临网上书店</title></head>
<body>
<jsp:include page="gouwuche/additem.jsp" flush="false"/>
<%
String id = request.getParameter("id");
if (null == id || "".equals(id))
{
%>
<jsp:forward page="catalog.jsp" />
<%
}
else
{
int productId = Integer.parseInt(id);
productBean pBean = pDAO.getproduct(productId);
%>
<table border="1">
<tr>
<th>商品</th>
<th>描述</th>
<th>价格</th>
<th>数量</th>
<th>备注</th>
</tr>
<tr>
<td><%=pBean.getProductName() %></td>
<td><%=pBean.getFactory() %></td>
<td><%=pBean.getPrice() %></td>
<td><%=pBean.getAmout() %></td>
<td><%=pBean.getRemark() %></td>
</tr>
</table>
<%
if (cart.isExist(new Integer(productId)))
{
out.println("该商品已在购物车中<br>");
}
else
{
%>
<a href="prouctinfo.jsp?add=<%=productId%>&id=<%=productId%>">加入购物车</a>
<br>
<%
}
%>
购物车中现有<%=cart.getNumOfItems()%>种图书
<a href="showcart.jsp">查看购物车</a>
<a href="catalog.jsp">查看所有图书</a>
<%
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -