• 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

Displaying search data

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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?

Thanks
Martin
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic