Hey guys!!! (and gals)...

Uhhmmm... I'm in a bit of a tiffy... Im trying to populate a drop down list with data in my query browser. But I AM NOT USING JAVASCRIPT...mostly because i havent learned it...but im trying to a certain table from the query browser to my drop down...

Thanks in advance! :)

well, you don't actually need javascript to do that.
since you are posting in the jsp forum, I assume the jsp/servlet combo would serve you best.
do you know anything about java coding?

Create a method in a class that executes the select query and retrieves the data. Save those data in an ArrayList.

In your jsp call that method and with a combination of html and java (scriplet) populate the drop down box

JSP:

<%
ArrayList list = yourClass.getData();
int size = list.size();
%>

<select name="someName">
<%
for (int i=0;i<size;i++) {
  String s = (String)list.get(i);
%>
<option value="<%=s%>" ><%=s%></option>
<%
}
%>
</select>

If the above code is confusing or doesn't make sense then you should do more studying about JSPs and html

Also you should already know how to run queries or use java core methods before going to JSP.
For your method that runs the query, better create a class that has a combination of 2 attributes (value, text). The ArrayList should have elements not Strings but of the class you created. When you run the query you would need a value to display and a value to use at the <option> :

JSP:

<%
ArrayList list = yourClass.getData();
int size = list.size();
%>

<select name="someName">
<%
for (int i=0;i<size;i++) {
  YourClass obj = (YourClass)list.get(i);
%>
<option value="<%=obj.getValue()%>" ><%=obj.getText()%></option>
<%
}
%>
</select>

You should know how to create your own classes and how to use them (get/set methods)

well, you don't actually need javascript to do that.
since you are posting in the jsp forum, I assume the jsp/servlet combo would serve you best.
do you know anything about java coding?

uhmmm...i now somethings... but not alot... i can link pages using only jstl.

uhmmm...i now somethings... but not alot... i can link pages using only jstl.

lik <c:import>'s and stuff...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.