Thread: vector problems

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    15
    Rep Power
    0
    could anyone please help...
    I'm trying to run a vector from my servlet that will take a list of names and write them to a drop down menu in my html.
    my problem seems to be the actual writing of the list to my web page.
    do you create the drop down menu on the page or through the vector?

    any advice more than welcome!

    Comments on this post

    • Gran Roguismo agrees
    • JimmyGosling agrees
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    35
    Rep Power
    15
    In your servlet doPost (or doGet), you can write the HTML something like:

    out.println("<select name="dropdown">");
    for (java.util.Enumeration enu=vector.elements(); enu.hasMoreElements() ; ) {
    out.println("<option value=""+enu.nextElement()+"">");
    }
    out.println("</select>");

    (Assuming that the elements of the Vector are Strings, of course.)

    Good luck, Ton

    [This message has been edited by tvanbart (edited September 29, 2000).]

    [This message has been edited by tvanbart (edited September 29, 2000).]

IMN logo majestic logo threadwatch logo seochat tools logo