在struts中使用checkbox实现批量删除

来源:互联网 发布:上海驿友微盒软件 编辑:程序博客网 时间:2024/04/19 14:04

    <form id="delForm" method="post" action="delFamilyAll.do">
      <div>

       <table align="center" cellpadding="4" cellspacing="1" border="0"
        width=100%>
        <tr>
         <td height="25" class="category t2" width=200>
          家庭管理>>家庭详细信息
         </td>
        </tr>
       </table>

       <table width="100%" height="5" border="0" cellspacing="0"
        cellpadding="0">
        <tr>
         <td align="center" height="20">
          <logic:empty name="list">
       没有相关数据 ...
       </logic:empty>
         </td>
        </tr>
       </table>
       <logic:notEmpty name="list">

        <table width="100%" align="center" cellpadding="0"
         cellspacing="1">
         <tr style="background-color: #3890B5; height: 30px"
          align="center">
          <td align="center">
           <span style="color: White">&nbsp;

          </td>
          <td align="center">
           <span style="color: White">所属小区
          </td>
          <td align="center">
           <span style="color: White">家庭名称
          </td>
          <td align="center">
           <span style="color: White">成立日期
          </td>
          <td align="center">
           <span style="color: White">操作
          </td>
         </tr>

         <logic:iterate id="family" name="list">
          <logic:present name="family">
           <tr style="background-color: #F6F6F6; height: 25px">
            <td align="center">
             <input type="checkbox" name="ids"
              value='<bean:write name = "family" property = "id"/>'>
            </td>

            <td align="center">
             <c:set var="id">
              <bean:write name="family" property="subdistrictId"></bean:write>
             </c:set>
             ${my:findSubName(id)}
            </td>
            <td align="center">
             <bean:write name="family" property="familyName"></bean:write>
            </td>
            <td align="center">
             <bean:write name="family" property="familyTime"></bean:write>
            </td>
            <td align="center">
             <!--  <a
            href="catSeleUp.do?id=<bean:write name="family" property="id"></bean:write>">
            <img src="admin/images/icon_edit.gif" style="border: 0"
             alt="编辑">
           </a> |
           -->
             <a onclick="return confirm('你确定要删除吗');"
              href="dele.do?id=<bean:write name="family" property="id"></bean:write>">
              <img src="admin/images/no.gif" style="border: 0" alt="删除">
             </a>
            </td>
           </tr>
          </logic:present>
         </logic:iterate>
        </table>
       </logic:notEmpty>
       <table cellspacing="1" cellpadding="0" width="100%"
        bgcolor="#9db2d4" border="0" align="center"
        style="text-align: center">

        <tbody>
         <tr bgcolor="#3890B5" height="25">
          <td style="width: 178px">
           <table width="100%" height="25" border="0" cellspacing="0"
            cellpadding="0">
            <tr>
             <td align="right" height="25">
              <input type="button" value="全选" height="25"
               onclick="for (var i = 0; i < delForm.ids.length; i ++){delForm.ids[i].checked = true;}" />
              <input type="button" value="反选" height="25"
               onclick="for (var i = 0; i < delForm.ids.length; i ++){delForm.ids[i].checked = false;}" />
              <input type="button" value="删除选中" height="25"
               onclick="if(confirm('真的要删除选中内容?'))delForm.submit()" />

             </td>
            </tr>
           </table>
          </td>

         </tr>
        </tbody>

       </table>


      </div>
     </form>