Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How i can create multiple pages dinamic with a servlet ?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi people:
I'm a beginner developer JSP/Java and i need a help to create some application for display the result of my search in DB in multiple pages ...
Like a forum, with previus and next stuff ...
Someone can help me ?!
Thanks !
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not aware of a safe, generalized way to do this. I've done several apps where we retrieved data from a backend service and limited the number of rows that would fit in one response. If the user wants to see more data, the client has to ask for the "next" set of rows.
If the data is not changing all the time, this isn't too hard. We have used a row number so the client request is give me rows 51-75, 76-100, etc. The server repeats the query used the first time, skips n rows, and gives back the next batch. We have also used the last primary key retrieved - give me 25 rows starting with the first key > this one. Either of these runs into trouble if the result set is changing - more rows or fewer rows or different rows than it had last time. Page forward might skip some rows. Page forward and backward might not give you the same results you saw before.
I suppose the surest way to give the user a self-consistent view is to retrieve the whole superset and store it somewhere, then page forward and backward through the private copy. That blows away the notion of a stateless server, tho.
 
Federico Delgado
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the idea ... But you have a sample code for that ?
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic