Jsp 如何获取到界面中的select 选择框的值

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:jsp

<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.jspthis

request.getParameter("item");

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

相关文章
相关标签/搜索