|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
displaying data in a select box using JSP
I'm hoping someone can help with displaying data from a db into a select box using JSP. Can work out the SQL, just not how to actually display the data.
have been unable to find any examples/info on select boxes so far, any suggestions would be much appreciated! |
|
#2
|
|||
|
|||
|
<%@ page import = “java.sql.*” %>
<HTML> <BODY> <% Connection con = DriverManager.getConnection("url",uid","pwd"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("Select colname from ur table"); out.println("<SELECT>"); while (rs.next()){ out.println("<OPTION>" + rs.getString(colname) + "</OPTION>"); } out.pritln("</SELECT>); %> </BODY> </HTML> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > displaying data in a select box using JSP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|