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

相關文章
相關標籤/搜索