Hey guys, I'm new to JSP and I want to make an order form with a dropdown list allowing the user to pick which product he/she wants to buy. And the products would come from the database i made. How can i retrieve the data from the database and place it in the dropdown list box?
AmIAyTi
0
Newbie Poster
Recommended Answers
Jump to Post<td colspan="3"><input name="text4" id="vid" type="text"/></td> <td colspan="1"> <select name="combo1" onchange="document.getElementById('vid').value=this.option[this.selectedIndex].text"> <option>Select One</option> <% stmt=con.prepareStatement("Select id from student order by id"); ResultSet rst=stmt.executeQuery(); while(rst.next()) { %> <option><%=rst.getString("id")%></option> <% } } catch (Exception e) { System.out.println("error in program:-"+e); } %> </select></td>
hope it might work for u..
That code is …
All 3 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
adil24
-3
Newbie Poster
javaAddict
commented:
Completeley wrong suggestion! Don't gibe bad advices
-3
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
kvprajapati
commented:
words :)
+14
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.