Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to paging database results in different html pages

 
juan ramon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
Someone can give me some examples code of how to add to my database result page the option of paging the results, I mean to put the next, previous navigation options.
My database is a postgres.
thanks
 
Rick Salsa
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi juan,
Take a look at sun's site.
/rick
[ January 21, 2002: Message edited by: rick salsa ]
 
shai koren
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
juan
If you dont use EJBs you could also add the data from the DB to a list of custome objects and store it in the session. then the links on the page will include params that will indicate the current index and weather it's "next" or "back" which according to you will either add or take the number_per_page (your variable in the servlet/jsp) to/from the index. you just need to watch yourself with the rules for "back" and "next" so that you dont actualy try to get items from the list with wrong index (like -n or more then the list actually has).
Of course if you work with ejbs forget about this one.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I disagree with putting search results on the session, but I disagree with putting anything on the session, in general
The best answer to your question is "it depends on the context".
This topic turns up very often and there is some very good material available in this and other forums and I'm not going to try to reproduce it here (I'm bound to get it wrong).
If you search the Servlet, JSP and JDBC forums you will find some excellent discussions.
Dave.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic