dynamically load drop-down in jsp

i am new to jsp and am trying to utilize a class of mine within a jsp. i have a method that collects the metaData from a database. I return a vector from my method containing all the table names that are within the database. I want to put those table names in a drop-down list within a jsp. Can anyone help me please?

[324 byte] By [greatfultobea] at [2007-11-27 1:24:21]
# 1
refer this link: http://forum.java.sun.com/thread.jspa?threadID=5159600&messageID=9608529#9608529
skp71a at 2007-7-12 0:15:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

<ur dropdown come here>

<%

Vector Test = new Vector();

Test = callfunctioncontainsdatabasevalues();

for(int i=0;i<Test.size();i++)

{

%>

<option><%=Test.get(i)%></option>

<%}%>

%>

kamal_shana at 2007-7-12 0:15:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thanks for the help! I got late last night with a "elementAt.(index)" format.
greatfultobea at 2007-7-12 0:15:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
hi i saw u rposting there can u give me u r code i have the same problem
Shoya at 2007-7-12 0:15:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

<ur dropdown come here>

<%

Vector Test = new Vector();

Test = callfunctioncontainsdatabasevalues();

for(int i=0;i<Test.size();i++)

{

%>

<option><%=Test.get(i)%></option>

<%}%>

%>

I found this useful snippet somwehere in this forum.

BalusCa at 2007-7-12 0:15:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

<?xml version="1.0" encoding="UTF-8" ?>

<%@ page contentType="text/html" %>

<%@ page pageEncoding="UTF-8" %>

<%@ page import="dataPack.*" %>

<%@ page import="java.util.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>York County Archives</title>

</head>

<body>

<% ConnectDB drop = new ConnectDB();

// int size;

Vector names = new Vector();

names = drop.getTableInfo();

//size = names.size();%>

<h1>Start Page for searching archives</h1>

<form method="post" action="extractData.jsp">

Please choose a table to search from drop-down:

<select name="userList" size="1" width="25">

<% for(int i=0; i<names.size(); i++){

%>

<option value='<%= names.get(i) %>' ><%=names.get(i) %></option>

<% } %>

</select> <input type="submit" name="submit" value=">> Next >>" />

<h3>OR...</h3>

<!--

Enter a table to search for:

<input type="text" name="tableInquiry" size="15" />

<input type="submit" name="submit" value=">> Next >>" />

<h3>OR...</h3>-->

<input type="submit" name="submit" value="View complete grid" />

</form>

</body>

</html>

greatfultobea at 2007-7-12 0:15:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...