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

paging in servlet/bean/jsp

 
diana b
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Diana
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i've written a mail to about your prob....check it please and do write to me if still ion prob
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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 http://www.javaranch.com/name.jsp . 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.
Thanks.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
james_deshpande
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Bhidu(means friend),
Connection conn=DriverManager.getConnection(.....)
((OracleConnection)conn).setDefaultRowPrefetch(30);
this way u can fetch 30 rows
each time u write
rs.next(){
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic