pagination

 Repo file : -

 @Query("select u from CreateHolidayPackageOne u where u.hpn = :hpn")public Page<CreateHolidayPackageOne> getByAllPackageByPagination(@Param("hpn") String ss,Pageable page);


AdminService : -

 Pageable p=Pageable.ofSize(15);

Page<CreateHolidayPackageOne> page=createHolidayPackageOneRepo.getByAllPackageByPagination(pkgName, p);

  m.addAttribute("coll", page);

  m.addAttribute("currentPage",p);

  m.addAttribute("totalPages",page.getTotalPages());


HTML page : -

<div class="holiday_pagination">

<p class="holiday_pagination_para" th:classappend="${currentPage==i-1?'active':''}" th:each="i:${#numbers.sequence(1,totalPages)}">


<a class="holiday_pagination_href"  th:href="@{'~/Holiday-package-searchs/' +${m1.packagename}+ '/' +${i-1}}"><span th:text="${i}"></span> </a>

</p>


</div>

Comments