在jsp页面中,从数据库中遍历出数据,按照下面表格结构显示,如何按行删除,即点击一行的删除命令就删除改行数据呢!?
  用户ID    用户名称  操作
    1          1      删除
    2          2      删除

解决方案 »

  1.   

    点击时连接到另外一个或本页,传递要删除的唯一标示,然后删除就可以了
    只要你数据库中每一个数据都有一个唯一的标识的话
    直接用delete from your_table where 唯一标示 = 唯一标示
      

  2.   

    你点删除的时候找到每个记录对应的用户ID,sql:delete from 表 where id=用户ID
      

  3.   

    <% for(int i=0;i<=count;i++)
    <tr>
    <td height="27" nowrap="nowrap" style="width:5%;"><%=i+1%>
    </td>
    <td style="width:12%;"><%=DataBean.getUserID()%>
    </td>
    <td style="width:7%;">
     <img src='images/del.gif' width="18" height="17" border=0 title='删除该用户' onclick="DelUser('<%=DataBean.getUserID()%>');"></a> 
    <input type="hidden" name="UserID">
    </td>
      </tr>
    %>
      在做循环的时候只能取到第一条记录!
      

  4.   

    我想利用form提交到一个servelet中删除,但在做上面的循环的时候只能取道第一条记录,请高手指点
      function DelUser(UserID)
      {
      if(confirm("您确定要删除此用户吗?这样将删除此用户将不可恢复。")==true)
    {   
    document.all.DelUserForm.UserID.value=UserID;
    DelUserForm.submit(); 
    }
      }
    </script>
      

  5.   

    <% for(int i=0;i<=count;i++)
    <tr>
    <td height="27" nowrap="nowrap" style="width:5%;"><%=i+1%>
    </td>
    <td style="width:12%;"><%=DataBean.getUserID()%>
    </td>
    <td style="width:7%;">
    <img src='images/del.gif' width="18" height="17" border=0 title='删除该用户' onclick="DelUser('<%=DataBean.getUserID()%>');"></a>
    <input type="hidden" name="UserID">
    </td>
    </tr>
    %>
    在做循环的时候只能取到第一条记录!
    ====================================
    你记录也没有movenext啊!这叫什么循环
      

  6.   

    <%out.print("&nbsp;<a href=DeleteFile.jsp?id="+rs.getInt("XXX")+"&page="+intPage+">删除</a>");%>