Im a newbie to web programming and programming in general . I written a web application that requires me to paginate my result set .
Ive implemented this pagination using jstl avoiding the usage of any custom tags.
Ive placed my jsp used to generate pagination in the code below.
The problems that I face currently are --
1. The value generated at point A is automatically typecasted to a floating value and hence the page links are displayed as 1.0,2.0,3.0 etc. I would like to display 1,2,3 instead , anyway I could work around to get that??
2.Secondly , I want to generate links for next page and previous page . But for this , I require the to be available outside the loop for each iteration so that I can use it to calculate my next page and previous page with respect to the current page. Or it would be great if anyone could suggest a method where I could display the next and previous links in the same c:forEach loop but only once rather than for each page
something like <Next> ..<Last>
Rather than <Next><Last><Next><Last>..
Thanks for your reply.
Your first suggestion worked like a breeze ,Thanks!
However , Im facing an issue with the next and previous links,here's how I approach it now.
But when I try this code the 'Previous ' link always points to a value of -pageNum and the 'Next' Link always points to the page beyond the last page . I guess the catch is in finding out how to print 'Next' and 'Previous' only once but take values for the generation of these links dynamically for each iteration.
Can anyone help me with that?
Thanks in advance.
EDIT : it looks like - Previous(Always point s to -pageSize) 1,2,3..,Next(Always points to page after last)