Personally I think it would be a bad idea to buffer the data from the db,
since most users when performing a search will only look at the first page
of results.  It would be better to simply return a limited set of results
from the DB.  Otherwise you might be fetching data the user will never see.

What I usually do is create an object that stores a list of the current
result set and the total number of results.  This object I create in the
data layer and requires two db calls.  One to get a limited list of results
and the second to get the total item count.

In the action I have an offset and resultsPerPage variable that I pass to my
data layer.  I don't know what database you're using but most allow you to
limit the results, using an offset and number of results.


KE LI-2 wrote:
> 
> Dear All,
> I am currently working on pagination to the result of search result. I  
> want to ask which solution is better?
> 1. After user chooses some criterias and then clicks the search  
> button, the server will return the size of search result and the  
> objects of first page of the search result. Then when user clicks the  
> different page number, the server will get the data for that page from  
> DB. But for this solution, it requires DB access when you click the  
> page number.
> 
> 2.After user clicks the search button, the server will get all the  
> objects(like all the films which the user wanna.). Then when user  
> clicks different page number, the server will just return the data  
> from memory. This seems to reduce the DB access times.
> 
> 3. Use some preload method to store the data for the next few pages in  
> a buffer.
> 
> Which solution will achieve a fast search and reduce the access load  
> to the DB?
> 
> Thanks a lot for your feedback!
> 
> Li, Ke (Licco)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Pagination-Questions-tp20744884p20749894.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to