David Newton wrote:What, specifically, are you having issues with?
How might pagination work? Well, we need to know how many pages of results there are... this is figured out using the total number of results, and the number of results per page.
We also need to know which results to show on the page: this is probably done by passing in the page number, and using that plus the number of results per page (already mentioned) to figure out the offset into the results.
Maybe try writing some code, or continue searching for "pagination" or "server pagination" if you're still having a problem getting started.
I have gained some knowledge of pagination and I think pagination using repeated access from database suits my requirement. I have found about limit and offset in select clause of mysql. I have found a logic of controlling the number of data extract from database.
If, say, Page variable represent my current page then I could have a query like this:
select * from employee limit 10 offset 10*(page-1);
As said, I will have a page in html like following:
Now, I have also learnt from this forum that no of rows in database can be found by following:
int i= rs.getRow();
where rs=ResultSet obj.
So I can now get the no of pages required like this:
if (i/10==0) then numPage=i/10
else if (i/10!=0) then numPage=i/10+1
Now I can display page links at bottom by having a loop which starts from 1 to numPage
Also I plan to use a static variable page which will keep track of current page.
So the Page number can be displayed by displaying value of page.
But I have following issues:
How do I detect the links clicked's corresponding number. I mean how do I set Page variable to 3 when I click on 3(link) at bottom of page.
Am I moving in right direction? Please give feedback? Any improvement suggestion....