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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Displaying search data

Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application that lists cities in states.
For example in State=Texas I will have links A B C D E F G.....X

On each link it will display cities starting by that alphabet.
I want to restrict cities being displayed by 10 on each page and provide a next,previous functionality.

I am using JDBC with SQL Server as my backend. Please give me suggestions how i can implement this in a JSP front end web application?

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the cities data doesn't change often, store the cities in some type of List. Each time a user clicks a different letter, such as B or M, goto the db and populate a new list of cities ordered asc for all the M cities. On the first display of the newly clicked M, display the first 10 cities in the list. You know at this point you won't need a previous because it's the first 10 cities. Check to see if an 11th entry exist, and if so, display the next button. On the next button, pass the index of the last city on the screen, such as 10. When the user clicks the next button, the user will be taken to the same page, but now start the index at (10+1) = 11 and show up to 10 more cities. If there are more citeis like 21-30, show the next button, also now if the index you passed, 10 is > than the max number of cities in the list, show the previous button. I hope this helps. Let me know if this is what you are looking for.
We find this kind of rampant individuality very disturbing. But not this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!