<%
  session.setMaxInactiveInterval(120);
   %>
   <jsp:useBean id="list" class="com.wish.CartArray" scope="session"/>
   <%
   ArrayList cartList = list.getList();
   Iterator it = cartList.iterator();
   Item item;
    %>
    <table align="center" border="1">
    <tr>
     <th>商品样式</th>
     <th>商品名称</th>
     <th>商品价格</th>
     <th>购买的件数</th>
    </tr>
    <%
    while(it.hasNext()){
     item = (Item)it.next();
     %>
    <tr>
     <td align="center">
     <img src="/webProject/img/<%=item.getPic() %>" width="80" height="150">
     </td>
     <td align="center">
     <%=item.getB_name() %>
     </td>
     <td align="center">
     ¥<%=item.getPrice() %>
     </td>
     <td align="center">
     <input type="text" size="6" value="<%=item.getBuyCount() %>">件
     </td>
    </tr>
    <%} %>
    </table>
把数量改了之后再怎么放入数据库????

解决方案 »

  1.   

    在每一个tr里加一个modify...button 去调用修改数据保存的方法
    推荐用.ajax
      

  2.   

    既然只是修改数据库的内容,就用SQL中的update语句不就行了?
      

  3.   

    我也不知道。我做了表单,然后提交给修改语句,但是只修改第一条数据
    看了一些内容好像是要用数组遍历循环~但是不知道怎么下手或许可以得到id,根据id来分别得数据,再update?有几个数据执行几次?