📄 cbrowseall.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="user" scope="session" class="jspD.User"/>
<jsp:useBean id="product" scope="page" class="jspD.Product"/>
<jsp:useBean id="DBLink" class="jspD.DBLink" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>消费者浏览所有商品</title>
<style type="text/css">
<!--
.style1 {
color: #339900;
font-weight: bold;
}
-->
</style>
</head>
<body>
<%@ include file="../Main.jsp" %>
<center>
<h2 class="style1">悠游网商户发布的商品</h2>
<h5 align="center"><a href="consumer.jsp">返回消费者页面</a></h5>
<table border="1" width="631">
<tr bgcolor="#999999">
<td width="194"><div align="center"><b>产品名</b></div></td>
<td width="131"><div align="center"><b>商家</b></div></td>
<td width="93"><div align="center"><b>单价</b></div></td>
<td width="47"><div align="center"><b>数量</b></div></td>
<td width="80"><div align="center"><b>购物</b></div></td>
</tr>
<%
//用于检验用户的合法性,以及加入用户。
ResultSet rs,rs1;
String sqlStr="select * from product";
rs=DBLink.executeQuery(sqlStr);
if(!rs.next())
out.print("<h2>数据库连接错误!</h2>");
else{
do{
product.setPName(rs.getString(1));
product.setProducer(rs.getString(2));
product.setPrice(rs.getFloat(3));
product.setQuantity(rs.getInt(4));
%>
<form name="shoppingForm" action="../cart/JCConform.jsp" method="post">
<tr>
<td><b><%=product.getPName()%></b></td>
<td><b><%=product.getProducer()%></b></td>
<td><b><%=product.getPrice()%></b></td>
<td><b><input type="text" name="quantity" size="3" value="1"></b></td>
<td><b>
<input type="submit" name="Submit" value="申请本产品的团购">
</b></td>
</tr>
<input type="hidden" name="pName" value=<%=product.getPName()%>>
<input type="hidden" name="producer" value=<%=product.getProducer()%>>
<input type="hidden" name="userEmail" value=<%=user.getEmail()%> >
<input type="hidden" name="price" value=<%=product.getPrice()%> >
<input type="hidden" name="busiEmail" value=<%=rs.getString(6)%> >
<input type="hidden" name="action" value="ADD">
</form>
<% }while(rs.next());
}
%>
</table>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -