• 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

Tables in servlets/JSP(Urgent !!)

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am qureying an oracle database and i want to display the results in a table having only 20 rows ,the next 20 rows should be displayed in the next page and so on and depending on the number of rows dynamic links should be generated say as we have in google search,could some one help me out with the logic/URL'S etc.any replies would be welcomed....
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did u find an answer to that, if so post it here plz
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as i see, there is no concept of disjointed recordsets in JDBC. Hence one has to create a kind of caching to achieve this. Previosly i had done this by maintaining a display counter variable in a session bean(which is toggled through the jsp's href), and fetching every time only that results that are defined by counter variable + FETCH_COUNT(say 20).
The problem with this was..even though i show only 20 at a time i had to still go through the whole resultset when user browses more than 20 results...
Another way is to serialize the results into a file and serve 20 from the file...but this leads to threading issues when on EJB servers..
Hope this gets u going and maybe someone might have better ideas..
 
amit malhotra
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Manjunath,
thanx a lot for the reply, But as far is EJB is concerned I am totally blank,Is this the way normal search engines like Google do it,please reply back
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by amit malhotra:
Hello Manjunath,
thanx a lot for the reply, But as far is EJB is concerned I am totally blank,Is this the way normal search engines like Google do it,please reply back


Hi,
The way I did this is:
When you get the results from the JDBC or any other call, store the results in a vector and a current index variable in the session (the index variable is to indicate the last row that is being displayed). If you are currently going forwar in the resultset, this will be the last row displayed among the 20 rows. If you are going backwards, this will be the first row among the 20 rows.
Give the users choice to get the previous 20 results or the nex 20 results. The URL for forward or reverse should have a flag that indicates to the JSP what to do (reverse or forward).
Based on which link they click, use the vector in the session, current index variable in the session and just decrement or increment from the index variable and show those elements from the vector. Also make sure you update the index variable to indicate the current position of the access.
Hope this helps.
Bala.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic