Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 不允许在组合框上设置选定值_Jsp - Fatal编程技术网

Jsp 不允许在组合框上设置选定值

Jsp 不允许在组合框上设置选定值,jsp,Jsp,先生,我有一个组合框,它的值是从数据库加载的。我的组合框编码如下 <select name="type" size="1" id="type" align="left"> <% Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con=DriverManager.getConnection("jdbc:mysql://localhost/online_

先生,我有一个组合框,它的值是从数据库加载的。我的组合框编码如下

<select name="type" size="1" id="type" align="left">

     <%
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         Connection con=DriverManager.getConnection("jdbc:mysql://localhost/online_exam?"+"user=root&password=pass");
         Statement stmt1=con.createStatement();
         ResultSet rs1=stmt1.executeQuery("select * from course");
         String courseid,crsname;

         while(rs1.next()){
                 courseid=rs1.getString(1);


         %>
         <option value=""><%=courseid%></option>
         <%}%>
</select>
当我运行时,我的项目值被加载到组合框中,但我无法从组合框中选择特定的值。该值与组合框的第一个值保持相同。你能告诉我问题在哪里吗