jsp将select控件值设置为选定值

时间:2014-03-07 22:57:47

标签: jsp

现在我有一个jsp代码

<table border="1">
                <tr>
                    <th>List of class(Section)</th>                                         
                    <th>ACTION</th>
                </tr>
                <tr>
                    <form action="query2.jsp" method="get">
                        <input type="hidden" value="select" name="action">

                        <th><select value="" name="sectionid" disable>

                          <%                              
                            Statement stmt = conn.createStatement();
                            ResultSet rs1 = stmt.executeQuery
                            ("select section_id,number, title, year, quarter from section");                                        

                            while(rs1.next()){
                            %>  
                                <option value ="<%= rs1.getString("section_id")%>"><%=rs1.getString("section_id")%>&nbsp&nbsp<%=rs1.getString("number")%>&nbsp<%=rs1.getString("title")%>&nbsp<%=rs1.getString("year")%>&nbsp<%=rs1.getString("quarter")%></option>
                            <%  
                            }
                            rs1.close();
                            %>

                        </select></th>   

                        <th><input type="submit" value="select" name="action" ></th>
                    </form>
                </tr>
              </table>  

但是,每次单击“选择”按钮时,它都会返回到选择控件的第一个值,而不显示我选择的那个值。 怎么做?

0 个答案:

没有答案