| Author |
vector pagination
|
michael yue
Ranch Hand
Joined: Nov 20, 2003
Posts: 204
|
|
I want to do pagination for jsp and planning to use vector for it. After I put all the data into the vactor, I not sure how to proceed. Should I use IndexOf method for vector? For example I want 20 records in a page so i should do something like below. for(x=0, x<=myvector.lastIndexOf(), x=x+20){ (for i=0, i<=x, i++){ myvector.indexOf(i); } } Is it correct? Or maybe someone have a better idea.
|
 |
Praful Thakare
Ranch Hand
Joined: Feb 10, 2001
Posts: 613
|
|
Rollin, Im not sure If there is any method called indexOf(int);which accepts int argument. And I guess for your requirement you can use elementAt(int index);which will return you java.lang.Object. So you need to cast it to appropriate Class. Hope this Helps Praful
|
All desirable things in life are either illegal, banned, expensive or married to someone else !!!
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
Rollin, Also, you only need one loop. Since you are only displaying one page at a time, you can loop through just the correct 20 elements.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
michael yue
Ranch Hand
Joined: Nov 20, 2003
Posts: 204
|
|
|
Will using third party components such as those in jsptags.com increase the performance such as becoming faster compared to vectors?
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
|
|
I guarantee you that the operation of Vector will never be significant in the speed of any servlet. Look at the source code for java.util.Vector - it is a really simple class. Bill [ March 01, 2004: Message edited by: William Brogden ]
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: vector pagination
|
|
|