• Post Reply Bookmark Topic Watch Topic
  • New Topic

Paging problem in jsp

 
nandhini sruthi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing mail part, In my inbox previous and next link are there,I have lot of massages in my inbox. i have combo box in another jsp page.In combo box contains 10,20,50,ect. while i select 10 in the combo box,the inbox should display 10 massages perpage.give any idea for me .

Thanks in advance
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you have submitted the number selected in the dropdown to the server, it should just be a matter of generating pages that contain that number of entries. You also need to keep track of which emails are on a particular page, so that you can generate appropriate "previous" and "next" links. Often that is done by keeping the index of the first item to display, and of the number of items to display, in the link URL.
 
Qussay Najjar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Nandhini,

What you're doing is a good techinque, I'll give you a hint using it, as I did previously in one of my applications...
The secret is as Ulf said, it's in the URL,
your URL would look like this one:


ease up, I'll explain how this url became like this:
first you calculate your full records and do some math, to know the
"Total Pages" and for sure you've already decided how many records to have in the page.
Look at these three methods, they would help,
this one is from Servlet called Pagination for example:



I believe the URL is more easy now,,,
Now to complete this pagination process, some code also needed in your JSP,
have a look please at the following one, in mail.jsp:



This one works perfectly, reply me incase of something foggy,
hope it helps.. have fun..
 
nandhini sruthi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot for your help,i understood well but i have one dought in this, how to get current page.

thanks in advance
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!