What do you mean by multiple vectors?
I have a program that uses a hashtable that stores a vector as objects.
Think of this as categories and items.
If I have a grocery store. I might have categories of
"Canned Foods", "Vegetables", "Meats".
And items inside of them
I have vectors for all the items under one category
so my vector for Canned Foods will look something like:
Beans | Peaches | Corn
I have a hashtable to store these keyed by category name:
Hashtable:
Key Value
"Canned Food" Vector( Beans | Peaches | Corn )
"Vegetables" Vector( Spinach | Broccoli | Tomato )
"Meats" Vector( Chicken | Veal | Pork )
So my program would do something like: (Not complete and not tested)
private Hashtable myStore;
public void createStore()
{
//database code: not best way to do db code and not
complete!
rCategories = stmt.execute("select category_name from
categories");
while( rCategories.next() )
{
String category = rCategories.getString(1);
Vector vItems = new Vector();
//database code: not best way to do db code and not
complete!
rItems = stmt.execute(
"select item_name from items where
category_name='"+ category +"'");
while( rItems.next() )
{
vItems.add( rs.getString(1) );
}
myStore.put( category, vItems );
}
}
-Tim
-----Original Message-----
From: Kenny Dao [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 11:10 AM
To: [EMAIL PROTECTED]
Subject: Re: Please help! Recursive loop in JSP
Hi
does any know or have an example of how to store
multiple vectors inside a hashtable?
thank
Ken
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com