This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes Vector Help..Urgent!!!!!!!!!!!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Vector Help..Urgent!!!!!!!!!!!!!!" Watch "Vector Help..Urgent!!!!!!!!!!!!!!" New topic
Author

Vector Help..Urgent!!!!!!!!!!!!!!

sam davis
Greenhorn

Joined: Jun 16, 2003
Posts: 18
Hello,
Im developing an application where a suer can search by username, password or email..while username must be unique, pswd n email can return multiple users. I know how to display the row if it returns only one user.
Vector vmembers = new Vector();
if((vmembers.size() == 1 )))
user = (User) vmembers.elementAt(0);
But, how do i display all the users if more than 1 record matches the search(vmembers.size() > 1)??.
Any help would be greatly appreciated. thanks
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821

How are you displaying the results? Is this a Swing-based application or a JSP-based application?
If it's Swing based, then you will probably want a JTable using a TableModel. Update the TableModel with your results list and the Table should populate. (See the Swing forum for more questions on that...)
If it's JSP based, simply iterate through the list and display the results of each record in turn. See the JSP/Servlet forums for more information on doing this.
(And strongly consider using a List instead of a Vector, BTW).
Hope that this helps,


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
sam davis
Greenhorn

Joined: Jun 16, 2003
Posts: 18
its a servlet based application. Thats what my problem is..i don't know how to extract the records one at a time from the Vector(if there are multiple records). Any help would be appreciated...
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821

Ah.
Try:

or
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vector Help..Urgent!!!!!!!!!!!!!!