Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pagination in jsp

 
payal Jain
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to do pagination in my jsp
I have arnd 100 of records from my dataase which I am storing as a collection in my class.
Now i have to display 12 record per page as 1,2,3..Next|View All record
please help me with the idea of How to accomplish that.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was the JSP FAQ entry on this subject not helpful?
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As said by Bear check if the JspFaq entry solves your problem. Then try a search through JSP forum .
There is also a Javaranch Journal article on pagination.

If you still face any problem let us know.


Hope this helps
 
payal Jain
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,jsp FAQ helped me,
but I am not able to understand one thing..
I have to fetch the data depending on increasing order of date from databse.
i give todays date as input and fetch 12 records after todays date for page 1.for my page 2 i give I stores the last date of my previous page and give it as a input for page 2.Now how to do If the user clicks the page 1 again?? and what if user directly clicked page 3..then there is no proper date for me to give it as an input...

now how to resolve this...please giude me
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The SQL statement that you feed to the DB must be exactly the same each time for paging to make sense. You shouldn't be changing any of the inputs, dates or otherwise, or the results are meaningless.

The only thing that changes from query to query is the "slice" of the result set that you are obtaining (for instance, with the LIMIT keyword of MySQL).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic