jsp页面如何查看列表列表

2025-09-25 17:30:39

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>

  

jsp页面如何查看列表列表

2、  </head>

    <body>

        <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>

            

jsp页面如何查看列表列表

3、    <tbody>

                  <c:forEach 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>

jsp页面如何查看列表列表

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>

       

jsp页面如何查看列表列表

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")

    }

    });

    })

jsp页面如何查看列表列表

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",{

                       

jsp页面如何查看列表列表

7、 "ids":checkedArray

                    },function (data) {

                        if(data.success){

                            alert("删除用户成功!");

                            location.href="${pageContext.request.contextPath}/admin/company/showList/1";

                        }

                    });}

                });

    })

    </script>

</html>

jsp页面如何查看列表列表

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢