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.
Thanks.
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
Should not be a problem. You can specify the appropriate JDBC driver for MySql in the code.
CodingExpert
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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_P AGE<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?pageN o=<%=pageN o+1%>">Nex t Page</a>
<a href="pagedQuery.jsp?pageN o=<%=pageN o-1%>">Pre vious Page</a>
int recNo=0;
while(pageNo*RESULTS_PER_P
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?pageN
<a href="pagedQuery.jsp?pageN
http://www.codeproject.com/useritems/DBGrid.asp