Yes, the display tag is horrible because it stores everything in memory, not just the page being displayed.
Quote:
1) how << first < previous [1 2 3 4 5 6 7 8 .......] next > Last >> should be calculated for jsp page
Hibernate queries only provide methods for setting the initial row and the number of items They do not scroll in "pages". So all those calculations would have to be done through extra Java code, and passed on to your JSP as beans or variables.
Quote:
2) and how clicking on a particular link from << first < previous [1 2 3 4 5 6 7 8 .......] next > Last >> gets the result for that particular number
Again, through custom Java code. Annoyingly, Hibernate queries with pagination, don't even provide you with the total count! (i.e., the count(*) of items if they were not paginated).
I usually execute 2 queries for each of these requests: one, the paginated query itsel,f the other, a query with the same parameters but calculating the count(*).
Your page size should be a configuration parameter. And you would hold a session-wide pointer which would hold the page on which you are sitting at any given point. It gets messy.