批量删除的问题

批量删除的问题

如何可以提取到选中的部门id,把选中的部门id放入一个list中?

http://img1.sycdn.imooc.com//climg/5f80d52208ba52e813720656.jpg

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<jsp:include page="/WEB-INF/pages/top.jsp"/>

<section id="content" class="table-layout animated fadeIn">
    <div class="tray tray-center">
        <div class="content-header">
            <h2> Department List </h2>
            <p class="lead"></p>
        </div>
        <div class="admin-form theme-primary mw1000 center-block" style="padding-bottom: 175px;">
            <div class="panel  heading-border">
                <div class="panel-menu">
                    <div class="row">
                        <div class="hidden-xs hidden-sm col-md-3">
                            <div class="btn-group">
                                <button type="button" class="btn btn-default light">
                                    <i class="fa fa-refresh"
                                       onclick="javascript:window.location.href='/dept/displayAll';"></i>
                                </button>
                                <button type="button" class="btn btn-default light">
                                    <i class="fa fa-trash"
                                       onclick="javascript:window.location.href='/dept/removeMulti';"></i>
                                </button>
                                <button type="button" class="btn btn-default light">
                                    <i class="fa fa-plus"

                                       onclick="javascript:window.location.href='/dept/toAdd';"></i>
                                </button>
                            </div>
                        </div>
                        <div class="col-xs-12 col-md-9 text-right">

                            <div class="btn-group">
                                <button type="button" class="btn btn-default light">
<%--                                    --%>
                                    <i class="fa fa-chevron-left"
                                       onclick="javascript:window.location.href='/dept/displayAll?pageNum=${pageInfo.pageNum -1}';"></i>
                                </button>
                                <button class="btn btn-default light">
                                    <span>${pageInfo.pageNum}/${pageInfo.pages}</span>
                                </button>
                                <button type="button" class="btn btn-default light">
                                    <i class="fa fa-chevron-right"
                                       onclick="javascript:window.location.href='/dept/displayAll?pageNum=${pageInfo.pageNum +1}';"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-body pn">
                    <table id="message-table" class="table admin-form theme-warning tc-checkbox-1">
                        <thead>
                        <tr class="">
                            <th class="text-center hidden-xs">Select</th>
                            <th class="hidden-xs">No</th>
                            <th class="hidden-xs">Department ID</th>
                            <th class="hidden-xs">Department Name</th>
                            <th class="hidden-xs">Address</th>
                            <th>Operation</th>
                        </tr>
                        </thead>
                        <tbody>

                        <c:forEach var="dept" items="${requestScope.pageInfo.list}" varStatus="idx">
                        <tr class="message-unread">

<%--                            --%>
                            <td class="hidden-xs">
                                <label class="option block mn">
                                    <input type="checkbox" name="multi" value="${dept.id}">
                                    <span class="checkbox mn"></span>
                                </label>
                            </td>
                            <td>${idx.index + 1}</td>
                            <td>${dept.id}</td>
                            <td>${dept.name}</td>
                            <td>${dept.address}</td>
                            <td>
<%--                                --%>
                                <a href="/dept/to_update?id=${dept.id}">Edit</a>
                                <a href="/dept/remove?id=${dept.id}">Remove</a>
                            </td>
                        </tr>
                        </c:forEach>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>
<jsp:include page="bottom.jsp"/>


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕阿慧 2020-10-10 10:53:09

同学你好,实现步骤参考如下:

a. 在部门列表页面中添加一个批量删除按钮。

b. 给按钮添加点击事件。当点击批量删除按钮时,获得要删除的部门id列表。将这些id值发送过去,如id=1,3,4。

c. 在后台对获得id值进行处理,如按照,逗号进行分隔获得每个id值,再调用departmentBiz.remove()方法。

如果我的回答解决了你的疑惑,请采纳!祝学习愉快!

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师