recently, I have been watching thymeleaf, to write some demo,. Today, I refer to Chestnut on the Internet to write a page to play
. Here is my redundant code
<a th:href="@{/allExchInfo(start=${page.number}+1,size=${page.size})}" class="page-link" data-th-attr="pageIndex=${page.number} + 1,start=${page.number}+1,size=${page.size}" aria-label="Next">
backend uses
public ModelAndView hello( HttpServletRequest request){
ModelAndView mv = new ModelAndView("/test");
Sort sort = new Sort(Sort.DEFAULT_DIRECTION, "id");
// Pageable pageable = new PageRequest(start, limit, sort); //page,size,sort
Integer start = request.getParameter("start") == null ? 0:Integer.valueOf(request.getParameter("start"));
Integer limit = request.getParameter("limit") == null ? 2:Integer.valueOf(request.getParameter("limit"));
Pageable pageable = new PageRequest(start, limit, sort);
Page<Exchange> page = exchangeService.findAll(pageable);
mv.addObject("page",page);
}
how can I not show that parameter start=1&size=2
method I thought about using post instead?
form submit?
do you guys have an elegant plan?