<ds:table name="${listNews}" pagesize="3" requestURI="${pageContext.request.contextPath}/notice" class="table table-condensed table-striped"> <ds:column title="<input type='checkbox' id='checkall' name='checkall' value='all'"> <input type="checkbox" id="noticeid" name="noticeid" /> </ds:column> <ds:column title="编号" property="id"></ds:column> <ds:column title="标题" property="title"></ds:column> <ds:column title="状态" property="status"></ds:column> <ds:column title="发布者" property="publisher"></ds:column> <ds:column title="发布时间" property="createtime"></ds:column> <ds:column title="修改" href="${pageContext.request.contextPath}/notice/toUpdate?id" paramId="id" paramProperty="id"> <span style="color: blue">修改</span> </ds:column> <ds:column title="查看" href="${pageContext.request.contextPath}/notice/details?id" paramId="id" paramProperty="id"> <span style="color: blue">详情</span> </ds:column> </ds:table> </form> </body> </html>
请问我如何获取全选之后的id,以数组的格式传递给后端进行批量删除?
后端代码为:
@RequestMapping("/delete") public String delete(int[] noticeId) { for (int i = 0; i < noticeId.length; i++) { boolean result = noticeService.deleteNewsById(noticeId[i]); if (result) { System.out.println("删除成功"); } else { System.out.println("删除失败"); } } return "/jsp/notice/noticelist.jsp"; }
慕虎7371278
相关分类