Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sam davis
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
sam davis
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah.
Try:

or
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic