• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

paging in servlet/bean/jsp

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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(){
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic