How to use pagesdialect??

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

How to use pagesdialect??

I use  th:each="order : ${orders}"  pages:paginate="" it works
But i don't understand what i must write in controller.

@RequestMapping(value = "/all", method = RequestMethod.GET)
    public String showAllOrders(Model model,
                                @RequestParam(required = false, defaultValue = "0") Integer page){
        if (page < 0)
            page = 0;
        long totalCount = orderService.count();
        int start = page * ITEMS_PER_PAGE;
        long pageCount = (totalCount / ITEMS_PER_PAGE) +
                ((totalCount % ITEMS_PER_PAGE > 0) ? 1 : 0);

        model.addAttribute("orders", orderService.getOrders(false, start, ITEMS_PER_PAGE));
        model.addAttribute("pages", pageCount);

        return "/admin/order/orders";

How to specify the total number of objects, and upload them to in parts?
Reply | Threaded
Open this post in threaded view

Re: How to use pagesdialect??


this is Zemi, the author of the PagesDialect. The dialect is a bit abandoned but stable. It has not been upgraded to Thymeleaf 3.

You can find the syntax of the different elements and examples at

Generally speaking, you don't set any arguments in the controller but as HTML attributes.

Kind regards,