Submit form and get selected data from dropdownlist in a servlet
i have a doPost() method
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExceptio开发者_Go百科n {
LOGGER.debug("Form Submitted with username: " + request.getAttribute("username"));
}
and my JSP
<select name="username" onchange="this.from.submit();">
<c:forEach var="ovr" items='${overrides}'>
<option value="${ovr.overrideId}">${ovr.userId}</option>
</c:forEach>
</select>
there's nothing logged, this suggests the form wasn't submitted...
Your onchange says this.from.submit()
and not this.form.submit()
精彩评论