Struts+Hibernate+DisplayTag标签+js+Div+css

<%@ 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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值