Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

iterating thru records

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a browsing page in jsp that will show 5 records at a time. I want to figure out how to make the user select the next button and be able to see the next 5 records if present and so on. Do i use javascripting for this functionality..or can this be implemented in jsp itself..
thanks
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the pager taglib. Very easy to use.. no need javascript at all
good luck
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iam not able to implement pager tag properly in my page..
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with iterating like this is, everytime the user wants to see the next 5, it will involve a trip to the server, where the JSP will be initialized to the next five records. This may or may not be a problem, depending on the round trip delay. If your records are rather simple, you can mirror them with javascript objects, and simply store them all in a javascript array, so the user will be able to scroll through them freely without incurring the overhead of a trip back to the server.
WS
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could put all records in session and retrieve 5 records every time.
Dan
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a peek at the dotJ grid component:
http://www.dotjonline.com/main/index.jsp?url=/taglib/grid/grid.jsp
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have atleast 50 records as of now in my database.. whcih will keep on increasing..
 
Joe Pardi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regardless of your solution, you will want to limit the number of records that is retrieved from the database. If you have alot of records to query, then a scrollable Resultset can be used to minimze the number of rows you actually traverse through. This reduces the amount of data sent over the wire.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!