File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes paging in servlet/bean/jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "paging in servlet/bean/jsp" Watch "paging in servlet/bean/jsp" New topic

paging in servlet/bean/jsp

diana b

Joined: Feb 02, 2001
Posts: 6
Hi everybody,
I know that my question is not a new here, but I would really appreciate if you help me.
We are using MVC model 2 (servlet/java beans/jsp).
All database operations I put inside of servlet, and I know that the max number of rows in a result set can be 500,
so we are retrieving the whole result set, and need to display 30 records per page.

But I don't use Vector, and I am not sure what should be done in servlet/bean/jsp in order to display first 30 rec, then next 30 rec, and so on...

If you can send me some code, that will explain this, I would really appreciate.

Thanks in advance
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
hi i've written a mail to about your prob....check it please and do write to me if still ion prob

Frank Carver

Joined: Jan 07, 1999
Posts: 6920
"diana b",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
If you're not using a Vector (hope you meant ArrayList?), then what are you using, and why? And where exactly are your problems, is this a general Java question, or a JSP question, or what?
Anyway, the OO way would be to write a java.util.ListIterator or iterator-like object for your result set and bind that in your session (request.getSession().setAttribute("myIterator", iterator) -- or, better still, make it part of the state you maintain in a session-bound JavaBean that encapsulate all your state and logic).
The jsps (or, better still, controller servlet) can then manipulate that iterator in response to user requests (eg /myapplication/myjsp.jsp?action=nextSet).
- Peter

Joined: Feb 13, 2001
Posts: 23
Dear Bhidu(means friend),
Connection conn=DriverManager.getConnection(.....)
this way u can fetch 30 rows
each time u write{
I agree. Here's the link:
subject: paging in servlet/bean/jsp
It's not a secret anymore!