phymeleaf 除取整_bootstarp + thymeleaf +Ajax分页

本文介绍了如何使用Ajax分页技术,结合Bootstarp分页样式,实现实时更新数据的功能。首先创建分页类Fenye,然后通过Thymeleaf和Ajax在前端动态管理分页按钮,并展示数据。控制层通过JdbcTemplate和BookMapper处理分页查询,最后展示了初始显示第一页数据的方法。
摘要由CSDN通过智能技术生成

首先用Ajax分页可以让网页不用刷新就能更新数据的技术

而且本项目用到了bootstarp中的分页样式

一、首先把分页的按钮做出来

因为需要当网页加载的时候就显示第一页的数据所以需要js的网页初始化功能

前台代码就需要放在js中生成

而分页按钮的多少又需要数据库中的数据多少来确定

需要Ajax来请求后台返回i数据

所以我们先写后台获取分页的数据

首先 分页类 Fenye.class

packagecom.itxinghua.baidu.pojo;public classFenye {//当前页

private intcurrentPage;//分页数据

private intcurrentCount;//总页数

private inttotalPage;//总数据

private inttotalCount;public intgetCurrentPage() {returncurrentPage;

}public intgetCurrentCount() {returncurrentCount;

}public intgetTotalPage() {returntotalPage;

}public intgetTotalCount() {returntotalCount;

}public void setCurrentPage(intcurrentPage) {this.currentPage =currentPage;

}public void setCurrentCount(intcurrentCount) {this.currentCount =currentCount;

}public void setTotalPage(inttotalPage) {this.totalPage =totalPage;

}public void setTotalCount(inttotalCount) {this.totalCount =totalCount;

}

@OverridepublicString toString() {return "Fenye{" +

"currentPage=" + currentPage +

", currentCount=" + currentCount +

", totalPage=" + totalPage +

", totalCount=" + totalCount +

'}';

}

}

至于实体类和映射文件我就不发到上面了,我是用逆向工程来创建的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值