📄 browsemyproduct.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="DBLink" class="jspD.DBLink" />
<jsp:useBean id="product" class="jspD.Product"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>浏览本商家产品</title>
<style type="text/css">
<!--
.style1 {color: #339900}
-->
</style>
</head>
<%@ include file="../Main.jsp"%>
<body>
<center>
<h2 align="center" class="style1" >消费者产品浏览页面</h2>
<table border="1" width="476">
<tr bgcolor="#999999">
<td width="194"><div align="center"><b>产品名</b></div></td>
<td width="85"><div align="center"><b>单价</b></div></td>
<td width="69"><div align="center"><b>数量</b></div></td>
<td width="44"><div align="center"><b>修改</b></div></td>
<td width="50"><div align="center"><b>删除</b></div></td>
</tr>
<%
//用于检验用户的合法性,以及加入用户。
ResultSet rs;
String sqlStr="select * from product where producer='"+user.getName()+"'";
rs=DBLink.executeQuery(sqlStr);
if(!rs.next())
out.print("<h2>数据库连接错误!或者没有查到商品</h2>");
else{
do{
product.setPName(rs.getString(1));
product.setPrice(rs.getFloat(3));
product.setMaxQuantity(rs.getInt(5));
product.setID(rs.getInt(7));
%>
<form name="shoppingForm" action="modifyProduct.jsp" method="post">
<tr>
<td><b><%=product.getPName()%></b></td>
<td><b><%=product.getPrice()%></b></td>
<td><b><%=product.getMaxQuantity()%></b></td>
<td><div align="center"><b>
<input type="submit" name="Submit" value="修改">
</b></div></td>
<td><div align="center"><b>
<input type="submit" name="Submit" value="删除">
</b></div></td>
</tr>
<input type="hidden" name="pName" value=<%=product.getPName()%> >
<input type="hidden" name="price" value=<%=product.getPrice()%> >
<input type="hidden" name="maxQuantity" value=<%=product.getMaxQuantity()%> >
<input type="hidden" name="ID" value=<%=product.getID()%> >
</form>
<% }while(rs.next());
}
%>
</table>
<p></p>
<a href='business.jsp'>返回管理界面</a>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -