I am trying to work with a Spring Data webpage. This is described here:
http://static.springsource.org/spring-data/data-jpa/docs/current/reference/html/repositories.html#web-pagination
Here is my Java method (Spring Web MVC @Controller):
@RequestMapping(value = "/list", method = RequestMethod.GET) public String list( @PageableDefaults(value = 50, pageNumber = 0) Pageable pageable, Model model) { log.debug("Params: pageNumber={}, pageSize={}", pageable.getPageNumber(), pageable.getPageSize()); ... }
And here is my Spring configuration:
<mvc:annotation-driven> <mvc:argument-resolvers> <bean class="org.springframework.data.web.PageableArgumentResolver" /> </mvc:argument-resolvers> </mvc:annotation-driven>
(The above configuration seems to be the way to do it now; the configuration approach described in the link is deprecated.)
When I actually try to control pagination using the page and page.size , the latter works very well, but the former does not. For example, if I clicked
http:
magazine exit
Params: pageNumber=0, pageSize=42
So, I know that the resolver argument comes in, but I'm not sure why it does not resolve the page number. I tried a bunch of other parameter names (e.g. page.number, pageNumber, page.num, etc.), and none of them work.
Does this work for someone else?