Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to handle Search results?

 
ravi inguva
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Freinds,
I have a doubt i am developing an web application as one of the requirement need to be as follows...
upon some search criteria i will query the database and retrive the resultset which contains thousands of records now i have to display the records on the clients browser in page-by-page iterator fashion
now my doubt is should i go for valuelist hander - caching like to display 50 records every time the user clicks next without hitting the database for every incrmental 50 records.if so then how should i handle this cahcing ....
should i keep the valuelisthandler object in the user session if so will it not harm applications performance as v are keeping the such huge object containing thousands of records in the session

or use a stateful session bean
or keep hitting the database to retrive every next 50 records
i want a best approach to handle such situations
i hope u people got my problem right....
thanks in advance
Ravi.I
 
Lipman Li
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
read the article
Data List Handler
 
Christian Ebage
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi inguva,
you may also use the Value List handler pattern
of the core J2EE patterns. I believe both the
data list handler and the value list handler
may provide a solution to your problem. Please
check this link for the Value List Handler Pattern:
http://developer.java.sun.com/developer/restricted/patterns/J2EEPatternsAtAGlance.html
You need to register to access this page,if you are
not. It does not cost any thing.
Ebage
SCJP
SCEA
[ October 28, 2002: Message edited by: Christian Ebage ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a similar experiance in one of the projects that I had executed . The way in which I had implemented it was , if i had to show let us say 10 records on the Search Results Screen , then i used to fetch the a Scrollable resultset , Use something like a Vector[] and populate it with the all the column values for the first 10 records. if the user clicks next , i used to execute the same query again , fetch the resultset and scroll to requested position before populating the Vector[]. The advantage here is u can easily put the Vector[] in session and use it in u'r JSP to show the Search resullts.
Also the Vector[] will have only 10 records or this number could be dynamically selected by the user too ...It's an easy way to implement paging ...not the best . In fact I had written a Taglib for this paging mechanism , which could be used across screens requiring Paging of search results
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic