aspose file tools*
The moose likes JSP and the fly likes pagination in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "pagination in jsp" Watch "pagination in jsp" New topic
Author

pagination in jsp

payal Jain
Ranch Hand

Joined: Dec 20, 2007
Posts: 50
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

Joined: Jan 10, 2002
Posts: 61437
    
  67

Was the JSP FAQ entry on this subject not helpful?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

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


SCJP, SCWCD.
|Asking Good Questions|
payal Jain
Ranch Hand

Joined: Dec 20, 2007
Posts: 50
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

Joined: Jan 10, 2002
Posts: 61437
    
  67

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).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: pagination in jsp