show 10 records per page

Hello,
i am writing a servlet to retreive records from a table in db2 database and show it them the browser. But i want to show only 10 records per page and there would be a next button on every page which would take to the next 10 records.
Pl tell me how do i acheive this.

Thanks
Rama
ramakrishna030399Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shaveriCommented:
0
Ravindra76Commented:

Hi Ramakrishna,

 Your previous questions

 add number of days  and
inserting double int string are solved?

 or

still are you facing problems?

Best of luck
0
ramakrishna030399Author Commented:
ya ravindra...
those problems were solved,..thanx a lot...
ragards
rama
0
memingCommented:
1) Create RecordSet using user query
2) Iterate through the first 10 (0..9) records and return to client a 10 row table in HTML. Also include in HTML with previous and next links such as this: <a name=next href="/servlet/Scroller?pageNum=1">
3) Before returning the first HTML page to client, save RecordSet in a static variable of the current class. (more later)
4) Once client clicks "next" link on the first HTML page, get the RecordSet object from the static variable and get the pageNum=1. Since 1*10=10, repeat step 2 starting from record number 11. This new HTMl should include <a name=prev href="/servlet/Scroller?pageNum=0"><a name=next href="/servlet/Scroller?pageNum=2">
5) repeat step 2 to 4 and skip 3 since you want to reuse the RecordSet.

As you might see here, this program will only work correctly for one client. If there are more than one concurrent client, saving RecordSet in a static variable may cause problem, since different users might wnat different queries/recordsets.

This is where database connection pool is needed. This's a way of managing multiple database connections or recordsets for multiple concurent users. You can implment it yoursleves by using hashtable with user session ids(watch out for synchronization problems), or you can find a premade one.  Most application servers support it.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ravindra76Commented:
Hi ramakrishna,

If your problems are solved, grade them.
If you don't grade them, they will automatically graded ( C graee) by EE
after some time.

Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.