I was looking for a way to do this too, but did not find any standard component or taglib. I think, mainly because paging can become very specific, since you need to get paging data from the database already (if you use Hibernate, you can easily do this using the API criteria). I came up with something like this:
public class Pager { private int page; private int results; private String sortOrder; private String sortColumn; // Getters and setters } @Controller public class StuffController { @Autowired SomeEntityService someEntityService; @RequestMapping("/test.html", method = Method.GET) public void getStuffPaged(@RequestParam("id") String id, Pager pager, ModelMap mm) { mm.addAttribute("entities", someEntityService.get(id, pager)); } }
If you execute the request at http://domain/app/test.html?id=10&page=1&results=30&sortOrder=asc , you will get a pager object in your request.
Daff Feb 11 '10 at 15:15 2010-02-11 15:15
source share