File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes how to handle Search results? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "how to handle Search results?" Watch "how to handle Search results?" New topic

how to handle Search results?

ravi inguva
Ranch Hand

Joined: Feb 07, 2002
Posts: 34
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

Sun Certified Java2 Programmer
Lipman Li
Ranch Hand

Joined: May 02, 2002
Posts: 122
read the article
Data List Handler
Christian Ebage
Ranch Hand

Joined: Aug 29, 2002
Posts: 47
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:
You need to register to access this page,if you are
not. It does not cost any thing.
[ October 28, 2002: Message edited by: Christian Ebage ]
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
I agree. Here's the link:
subject: how to handle Search results?
It's not a secret anymore!