当前位置: 首页 > news >正文

spring boot+thymeleaf+semantic ui 分页

参考:

https://my.oschina.net/ayyao/blog/898041

后端 springboot 使用:

com.github.pagehelper.PageInfo,作为分页对象

<!--引入分页插件-->
<dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.2.12</version>
</dependency>controller里代码:import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;String orderBy = "id desc";
PageHelper.startPage(pageNum, 10, orderBy);
List<User> users = userService.list();
if (users != null) {PageInfo<Type> pageInfo = new PageInfo<>(types);model.addAttribute("pageInfo", pageInfo);
}

前端分页代码:


<tfoot><tr><th colspan="6" ><!--分页条 begin--><div class="ui left floated pagination mini menu"><!-- 首页 --><a th:href="@{/sss/userapi(pageNum=1)}" class="icon item" >首页</a><!-- 上一页previous --><a th:if="${pageInfo.hasPreviousPage}" class="icon item" th:classappend="${pageInfo.pageNum}==0 ? 'disabled' : ''"th:href="@{/sss/userapi(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}"><i class="angle left icon">上一页</i></a><!-- 中间页面1-10页面--><div th:each="p : ${pageInfo.navigatepageNums}"><a class="icon item" th:classappend="${pageInfo.pageNum}==${p} ? 'disabled' : ''"th:href="@{/sss/userapi(pageNum=${p})}"><i th:text="${p}"></i></a></div><!-- 下一页next --><a th:if="${pageInfo.hasNextPage}" class="icon item"th:href="@{/sss/userapi(pageNum=${pageInfo.pageNum+1})}">下一页<i class="angle right icon"></i></a><!-- 尾页 --><a th:href="@{/sss/userapi(pageNum=${pageInfo.pages})}" class="icon item" >尾页</a></div><!--分页条 end--></th></tr>
</tfoot>

首页、中间页、尾页样式:

其他:

Thymeleaf循环语句_thymeleaf 循环_苦海无边,不能上岸的博客-CSDN博客

Table | Semantic UI 官网

http://www.lryc.cn/news/105289.html

相关文章:

  • 【JVM】(一)深入理解JVM运行时数据区
  • C++ QRegExpValidator
  • 备战秋招 | 笔试强训19
  • 第一章 计算机网络概述
  • 谷粒商城第六天-商品服务之分类管理下的获取三级分类树形列表
  • 【UI自动化测试】Appium+Python+Unittest+HTMLRunner
  • 【限时优惠】红帽openstack管理课程(CL210) 即将开课
  • Golang之路---02 基础语法——函数
  • 数据结构和算法入门(时间/空间复杂度介绍--java版)
  • Spring Mvc 文件上传(MultipartFile )—官方原版
  • 【E题】2023年电赛运动目标控制与自动追踪系统方案
  • 企业网络安全之零信任和身份认证
  • 【雕爷学编程】MicroPython动手做(28)——物联网之Yeelight 5
  • [运维|中间件] 东方通TongWeb使用笔记
  • WIZnet W6100-EVB-Pico DHCP 配置教程(三)
  • 【Linux】Ansible 脚本 playbook 剧本
  • 解决 tensorflow 出现的 ImportError: Could not find the DLL(s) ‘msvcp140_1.dll‘. 问题
  • 百度与AI:历史、投资和监管
  • Kafka3.0.0版本——Broker(Zookeeper服务端存储的Kafka相关信息)
  • 【图论】无向图连通性(tarjan算法)
  • Docker安装
  • 06. 计数原理
  • 计算机网络基础(静态路由,动态路由,公网IP,私网IP,NAT技术)
  • CGAL 点云Alpha-Shape曲面重建算法
  • Java 文件过滤器FileFilter | 按条件筛选文件
  • python格式化地址信息
  • k8s1.26.6 安装gitlab
  • C5.0决策树建立个人信用风险评估模型
  • 【k8s集群部署】使用containerd运行时部署kubernetes集群(V1.27版本)
  • 网络安全进阶学习第八课——信息收集