重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Spring Data中的分页功能如何留 JPA+kkpager实现?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
创新互联公司主要从事成都网站建设、成都做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务龙圩,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220一、spring Data JPA分页
分页效果如下:
前台表格用的是: Bootstrap
分页插件用的是: kkpager
kkpager是一个js分页展示控件,传入简单参数就能使用的分页效果控件,github地址:https://github.com/pgkk/kkpager
项目结构:
FamilyMember实体类:
package com.fendo.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name="FAMILY_MEMBER") public class FamilyMember implements Serializable{ private Integer id; private String FamilyName; private String FamilyCharge; private String Mobile; private String Email; private String Address; private Date CreateData; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Column(name="FAMILY_NAME") public String getFamilyName() { return FamilyName; } public void setFamilyName(String familyName) { FamilyName = familyName; } @Column(name="FAMILY_CHARGE") public String getFamilyCharge() { return FamilyCharge; } public void setFamilyCharge(String familyCharge) { FamilyCharge = familyCharge; } @Column(name="MOBILE") public String getMobile() { return Mobile; } public void setMobile(String mobile) { Mobile = mobile; } @Column(name="EMAIL") public String getEmail() { return Email; } public void setEmail(String email) { Email = email; } @Column(name="ADDRESS") public String getAddress() { return Address; } public void setAddress(String address) { Address = address; } @Column(name="CREATE_DATA") public Date getCreateData() { return CreateData; } public void setCreateData(Date createData) { CreateData = createData; } public FamilyMember() { super(); // TODO Auto-generated constructor stub } public FamilyMember(Integer id, String familyName, String familyCharge, String mobile, String email, String address, Date createData) { super(); this.id = id; FamilyName = familyName; FamilyCharge = familyCharge; Mobile = mobile; Email = email; Address = address; CreateData = createData; } }