📄 browseproduct.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" scope="session" 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>
<body>
<%@ include file="../Main.jsp"%>
<h2 align="center" class="style1" >管理员浏览页面</h2>
<h5 align="center"><a href="manager.jsp">返回管理页面</a></h5>
<center>
<table border="1" width="597">
<tr bgcolor="#999999">
<td width="209"><div align="center"><b>产品名</b></div></td>
<td width="165"><div align="center"><b>商家</b></div></td>
<td width="133"><div align="center"><b>单价</b></div></td>
<td width="62"><div align="center"><b>购物</b></div></td>
</tr>
<%
//用于检验用户的合法性,以及加入用户。
ResultSet rs;
String sqlStr="select * from product";
rs=DBLink.executeQuery(sqlStr);
if(!rs.next())
out.print("<h2>数据库连接错误!</h2>");
else{
do{
product.setPName(rs.getString(1));
String nameP=product.getPName();
product.setProducer(rs.getString(2));
product.setPrice(rs.getFloat(3));
product.setQuantity(rs.getInt(4));
%>
<form name="shoppingForm" action="delProductConform.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="submit" name="Submit" value="删除"></b></td>
</tr>
<input type="hidden" name="pName" value=<%=product.getPName()%> >
</form>
<% }while(rs.next());
}
%>
</table>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -