📄 searchproductbycategory.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="com.jspdev.ch12.*,java.util.*,java.io.*" errorPage="error.jsp" %>
<%@ include file="trans.jsp"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<jsp:useBean id="product" class="com.jspdev.ch12.ProductBean" scope="page"/>
<body>
<center>
<% String category=request.getParameter("category");%>
<h1>查看类别为<font color=red><%=category%></font>的商品</h1>
<table width=80% border="1" bgcolor="#0099CC">
<tr bgcolor="#009966" bordercolor="#990066">
<td>id</td><td>类别</td><td>名称</td><td>出厂商</td><td>价格</td><td>描述</td>
</tr>
<%
Collection products=product.getProductByCategory(category);
Iterator it=products.iterator();
while(it.hasNext())
{
Product temp=(Product)it.next();
out.println("<tr bordercolor=#990066>");
out.println("<td>"+temp.getProductId()+"</td>");
out.println("<td>"+temp.getCategoryId()+"</td>");
try
{
out.println("<td>"+temp.getName()+"</td>");
out.println("<td>"+temp.getProducer()+"</td>");
out.println("<td>"+temp.getPrice()+"</td>");
out.println("<td>"+temp.getDescription()+"</td>");
}
catch(Exception e)
{}
out.println("</tr>");
}
%>
</table>
<a href="index.html">返回</a>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -