How do I get the selected value from the drop-down list in jsp?

advertisements
<select name="item">
<c:forEach items="${combo}" var="id">
    <option value="${id}">${id}</option>
</c:forEach>
</select>

How can we get the selected value from the above dropdown list?


I know that this is an old question, but as I was googling it was the first link in a results. So here is the jsp solution:

<form action="some.jsp">
  <select name="item">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
  </select>
  <input type="submit" value="Submit">
</form>

in some.jsp

request.getParameter("item");

this line will return the selected option (from the example it is: 1, 2 or 3)