Discussion Locked

JDBC

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
i have one servlets where i am storing my results from database in ResultSet object.at the time of diplay on the browser i want to diaplay just 10 reults and rest with the link at bottom with next.this concpet is some what like search reults what wehave when search for something on net with any search engine.please help me.

5 replies

by terziev

write a class that puts the result set in a vector and then sub-list the required number of rows to be printed. the nice thing is this approach is that you can save the vector in the session and that you don't have to query the database when you move to the scren with the entries from the next page.

also, check out the Turbine Servlet Framework from Apache Group. Turbine comes with Village and with Village you don't even have to write a separate class.

by jim.locum

I've developed a system that uses a Vector with all the results contained in it. The paging is done by passing hidden form fields containing the desired "page" number and # displayed per page. Quick arithmetic can supply the correct starting value.

Plus you may not want to leave a ResultSet object open which ties up a dbase connection and resources.

Jim

This discussion is closed to new replies.