提交表单并从servlet中的下拉列表中获取所选数据

时间:2011-05-12 15:24:28

标签: servlets

我有一个doPost()方法

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    LOGGER.debug("Form Submitted with username: " + request.getAttribute("username"));
}

和我的JSP

<select name="username" onchange="this.from.submit();">
  <c:forEach var="ovr" items='${overrides}'>
    <option value="${ovr.overrideId}">${ovr.userId}</option>
  </c:forEach>
</select>

没有任何记录,这表明表单未提交......

1 个答案:

答案 0 :(得分:0)

您的onchange代表this.from.submit()而非this.form.submit()