• 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

Struts Pagination

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I need to display the search results using struts and display tag. Following are the ways i have in mind to implement this but i would like to know the best optimal solution before start my development.

1) retreive the complete search results and store into the HttpSession object.
This may be a performance bottleneck if concurrent sessions opened.

2) retrieve the records from database on demand (let say 10 records per user hit).
Results in more number of costly database calls.

3) retreive the part from database and store into the HttpSession object, let say my search results in 1000 matching records and i will get the first 100 records from the database and put it in the HttpSession object. When the user clicks on page 11, i will query the database again and retreive another 100 recods and store/overwrite into HttpSession object.
I think this is the better approach among the above three.

Please let me know if you have any other better solution and how to implement.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The 3rd approach is the most preferred .
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is usually not a single "best" solution that fits all applications. Your #3 sounds good, but it is also the solution that requires the most work to implement, debug, document and maintain. If you are dealing with small sets of data you may want to not do any caching yourself and let the database handle that.

- Brent
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Senthil... H R U? do chk your yahoo mailbox for more qns !
 
reply
    Bookmark Topic Watch Topic
  • New Topic