springboot 提取导航栏,插入导航栏

1.提取公共页面

  1. 给提取部分取名
    th:fragment="topbar"
  2. 添加提取部分
<!--引用dashboard的侧边导航栏-->
        <div th:insert="~{comment/comment::topbar(active='list.html')}"></div>
  1. 如果要传递参数
<!--传递参数-->
        <div th:insert="~{comment/comment::sidebar(active='dashboard.html')}"></div>
<!--接收参数-->
         <a th:class="${active=='dashboard.html'?'nav-link active':'nav-link'}">

2列表循环展示

<thead>
                    <tr>
                        <th>id</th>
                        <th>lastName</th>
                        <th>email</th>
                        <th>gender</th>
                        <th>department</th>
                        <th>birth</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="emp:${empS}">
                        <td th:text="${emp.getId()}"></td>
                        <td>[[${emp.getLastName()}]]</td>
                        <td th:text="${emp.getEmail()}"></td>
                        <td th:text="${emp.getGender()==0?'女':'男'}"></td>
                        <td th:text="${emp.getDepartment().getDepartmentName()}"></td>
                        <td th:text="${#dates.format(emp.getBirth(),'yyyy-MM-dd HH:mm:ss')}"></td>
                        <td>
                            <button class="btn btn-sm btn-primary">编辑</button>
                            <button class="btn btn-sm btn-danger">删除</button>
                        </td>
                    </tr>
                    </tbody>

相关文章

今天小编给大家分享的是Springboot下使用Redis管道(pipeline...
本篇文章和大家了解一下springBoot项目常用目录有哪些。有一...
本篇文章和大家了解一下Springboot自带线程池怎么实现。有一...
这篇文章主要介绍了SpringBoot读取yml文件有哪几种方式,具有...
今天小编给大家分享的是SpringBoot配置Controller实现Web请求...
本篇文章和大家了解一下SpringBoot实现PDF添加水印的方法。有...