<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@ page import="com.pojo.Sortp"%>
<%@ page import="com.dao.SortpDAO"%>
<%@ page import="com.dao.ProductsDAO"%>
<%@ page import="com.pojo.Products"%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/screen.css">
</head>
<body>
<%
if (request.getParameter("sid") != null) {
String id = request.getParameter("sid");
//通过sid查询商品
int sid = Integer.parseInt(id);
ProductsDAO pdao = new ProductsDAO();
List<Products> productsList = pdao.getProductsById(sid);
request.setAttribute("productsList", productsList);
}
SortpDAO sdao = new SortpDAO();
List<Sortp> list = sdao.getAllSort();
%>
<form action="#" method="get">
请选择商品类别:
<select name="sid">
<%
for (Iterator<Sortp> it = list.iterator(); it.hasNext();) {
Sortp sortp = it.next();
%>
<option value="<%=sortp.getId()%>"><%=sortp.getName()%></option>
<%
}
%>
</select>
<input type="submit" value="显示详情">
</form>
<hr>
<display:table name="productsList" pagesize="4">
<display:column property="name" title="商品名称" href="search.do" paramId="pid" paramProperty="id" />
<display:column property="price" title="商品价格" sortable="true" />
<display:column property="descript" title="商品描述" />
</display:table>
<%
sdao.CloseSession();
%>
</body>
</html>