1、<%@ page contentType="text/html;charset=UTF-8" language="java" %><%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><html> <head> <title>公司列表</title> <script src="${pageContext.request.contextPath }/resources/page.js"></script>
2、 </head> <body> &盟敢势袂lt;div class="container媪青怍牙"> <jsp:include page="inc.jsp"/> <table class="table table-striped"> <thead> <tr class="danger"> <th></th> <th>名称</th> <th>负责人</th> <th>联系电话</th> <th>公司图片</th> <th>地址</th> <th>email</th> <th>操作</th> </tr> </thead>
3、 <tbody> <c:for苇质缵爨Each items="${list}" var="product"> <tr> <td><input type="checkbox" value=${product.id } class="comId"/></td> <td id="base">${product.name}</td> <td >${product.person}</td> <td >${product.phone}</td> <td >${product.img}</td> <td >${product.adress}</td> <td >${product.email}</td> <td > <a href="${pageContext.request.contextPath }/admin/company/${product.id}">详情</a></td>
4、 </tr> </c:forEach> </tbody> </table> <input id='pageNo' value='${page.pageNo }' hidden="hidden"/>${page.pageHtml } 操作:<a class="btn btn-danger" role="button" href="${pageContext.request.contextPath}/admin/company/add">添加产品</a>
5、 <a id="deleteBtn" class="btn btn-danger" role="button" >删除产品</a> </div> </body> <script type="text/javascript"> $(function(){ $('#pageUl li').each(function(i) { var no = $(this).children().text(); var pageNo = $('#pageNo').val(); if (pageNo == no) { $(this).addClass("active") } }); })
6、 </script> <script type="text/javascript"> $(function(){ $("#deleteBtn").on("click",function(){ var checkedArray = []; $("input[class='comId']:checked").each(function () { checkedArray.push($(this).val()); }); if(checkedArray.length == 0){ alert("请至少选择一个"); }else{ $.post("${pageContext.request.contextPath}/admin/company/delete",{
7、"ids":checkedArray },function (data) { if(data.success){ alert("删除用户成功!"); location.href="${pageContext.request.contextPath}/admin/company/showList/1"; } });} }); }) </script></html>