i have a question when i try to capture the value of dropdown list from jsp file to servlet.
我有一个问题,当我尝试从jsp文件捕获下拉列表的值到servlet。
<select name="extraroom">
<c:if test="${booking.roomType ne 'single'}">
<c:forEach var="i" begin="0" end="${booking.count}">
<option value="<c:out value="${i}"/>"><c:out value="${i}"/></option>
</c:forEach>
</c:if>
</select>
i use Integer.parseInt(request.getParameter("extraroom"))
我使用Integer.parseInt(request.getParameter(“extraroom”))
i have many drop down lists according to different roomType. but the result in java servlet always get the value of the first dropdown lists...
我根据不同的roomType有很多下拉列表。但是java servlet中的结果总是得到第一个下拉列表的值...
what should i change in servlet?
我应该在servlet中改变什么?
Thank you.
1 个解决方案
#1
0
For a select to be retrieved by a server the select has to
对于要由服务器检索的选择,select必须
- be inside a form and
- have a unique name identifier inside (it; best the identifier is unqiue across the entire DOM tree)
在一个表格里面
内部有一个唯一的名称标识符(它;最好的标识符在整个DOM树中是unqiue)
#1
0
For a select to be retrieved by a server the select has to
对于要由服务器检索的选择,select必须
- be inside a form and
- have a unique name identifier inside (it; best the identifier is unqiue across the entire DOM tree)
在一个表格里面
内部有一个唯一的名称标识符(它;最好的标识符在整个DOM树中是unqiue)