Link to home
Start Free TrialLog in
Avatar of SuAeE
SuAeE

asked on

display search results in multiple pages, very urgent (not too difficult)

Hi all, When displaying searched for items I am displaying them in a html table. Id like the search to span into a new page when the amount of items exceeds ten and another page if it exceeds twenty etc etc. Something like how google displays multiple pages for search results. How is this possible?
Thanks.
Avatar of CodingExperts
CodingExperts

See if this is of any help....
http://www.codeproject.com/useritems/DBGrid.asp
Avatar of SuAeE

ASKER


Btw, Im using a mysql database.
> Im using a mysql database.
Should not be a problem. You can specify the appropriate JDBC driver for MySql in the code.

CodingExpert
ASKER CERTIFIED SOLUTION
Avatar of MogalManic
MogalManic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SuAeE

ASKER


I had a look at that and to be honest it seems too complicated for me :( . And I really cant stand sifting through large amounts of code, much rather write it myself. Any other ideas?
SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could also query the database on each page.  Increment/Decrement the pageNumber and post it on the request and when the query is executed, skip the results up until the page requested:
int recNo=0;
while(pageNo*RESULTS_PER_PAGE<recNo) {
   rs.next();  //Skip results in ResultSet before requested page
}

Then process the results up to RESULTS_PER_PAGE.

The pageNumber could be incremented/decremented in a link like this:
<a href="pagedQuery.jsp?pageNo=<%=pageNo+1%>">Next Page</a>
<a href="pagedQuery.jsp?pageNo=<%=pageNo-1%>">Previous Page</a>