1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <select multiple name="selection" >
<%Statement state = null;
try {
Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://localhost:5432/PROJET";
String user = "postgres";
String passwd = "projet";
Connection conn = DriverManager.getConnection(url, user, passwd);
state = conn.createStatement();
// conn.setAutoCommit(false);
} catch (Exception e) {
e.printStackTrace();
}
ResultSet rst = null;
String req="select num from etudiant";
rst=state.executeQuery(req);
while(rst.next()){
%>
<option value="<%=rst.getString("num")%>"><%=rst.getString("num")%></option>
<% } %>
</select>
</body>
</html> |
Partager