如何使用迭代器从数据库填充下拉列表?jsp



我试图填充下拉与类型的汽车从我的数据库,我已经成功地对另一个jsp页面上的列表执行了此操作,但是现在当我想对下拉列表执行相同的操作时,它不起作用。我可以看到它在数据库的表上移动因为下拉列表中有3个空格。(我的表目前包含3辆车)。

<jsp:useBean id="vs" scope="request" type="java.util.List" />
.
.
.
<tr>
    <td style="color:red; font-weight:bold">Vehicle:  </td
      <td> <select name= "vehicles" style="width: 100px">
           <% 
              Iterator it = vs.iterator();
              while (it.hasNext()) {
                   Vehicles vehicles = (Vehicles) it.next();
            %>
            <option value= <%=vehicles.getId()%> ${vehicles.getMake()} </option>
            <% } %>
            </select>         
      </td>
</tr>
.
.
.

提前感谢!

replace

 <option value= <%=vehicles.getId()%> ${vehicles.getMake()} </option>

<option value= <%=vehicles.getId()%>><%={vehicles.getMake()%> </option>

最新更新