Wednesday, 11 September 2013

Pagination with use of Spring and JSP

Pagination with use of Spring and JSP

I want to make pagination on my website but I'm not sure how to handle
form submiting. I mean that I have a form which stores some selected
checkboxes which I need to pass while navigating to another page. Here's
what I have:
<form:form modelAttribute="form" id="mainForm" action="/${pageNumber+1}"
method="GET">
<form:checkboxes items="${selectedcbx}" path="selectedcbx"
onclick="load(true);"/>
<a id="nextPageLink"
onclick="document.getElementById('mainForm').submit()">next</a>
but this will only submit my form and process my method:
@RequestMapping(value = "/{pn}", method = RequestMethod.GET)
which is fine, but how to handle other links like "previous" or given page
number so I can have " prev 1 2 3 4 5... next " ? Is it possible to put
action as a part of tag? I know that was possible in freemarker but Im not
sure If it is in jsp.

No comments:

Post a Comment