> we would like to give an option to ther user to restrict his search
> results to a particular number and provide a button to go the next
> results as we have in common search engines
>
Hi,
    if you have a dependable ordering of the search results you can page
through the
results by

a) limiting the rows returned by the SQL query (in mySQL use limit 20 to
limit it to 20 rows)

and

b) pass the last field value of the current result set and the last value of
the previous result set that determine the order of the rows returned
so you can page forwards by saying something like select * from table where
order_field > last_order_field_value order by order_field
and backwards by select * from table where order_field >
previous_last_field_value order by order_field.

Hope that helps

Andy Bailey

PS for small result sets (on the order of ~100 results you could try making
a Vector of Objects that match the fields in the rows.
The first time through you could pull the entire result set out, create your
vector, store it in a session object and page through the vector.
As long as you check that the search parameters are the same (ie type of
search and key values) you can keep using the Vector instead.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to