Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSP Vector Elements

843835Apr 22 2002 — edited Jul 19 2002
hi,

I build up a vector of results received from a database query.
Here is the code I use:

if (resulset.next())
{

int rowcount = resultsetmetadata.getColumnCount();

do {
Vector rowVector = new Vector();

for (int i = 1; i <= rowcount ; i++) {
rowVector.addElement(resultset.getObject(i));
}
WOVector.addElement(rowVector);
} while (resultset.next());

}

The vector now returns, for instance 4 fields per element in the Vector

How, when retrieving the elements, can I easily retrieve each field in each element?

Say I get back the following two rows:

element 1 : [Peter,Blue,555]
element 2 : [Susan,White,666]

How can I retrieve the value of element2, field 2, being "White", without doing something like:


element2field2 = WOVector.elementAt(2).toString();

getting the first ",", getting the second ","
using substring to retireve the value between the two ","
etc..


?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 16 2002
Added on Apr 22 2002
10 comments
176 views