gpt4 book ai didi

java - 获取从一个jsp到另一个jsp生成的多个值数据库下拉列表

转载 作者:行者123 更新时间:2023-12-01 16:18:06 24 4
gpt4 key购买 nike

Output of drop down getting values from database

<td> 
Chose Country : <br><select name ="Country" id="country" size="20" style="width: 90%;" multiple>
<%while (resultset.next()) {%>
<option value="<%=resultset.getString(1)%>"><%=resultset.getString(1)%></option>
<%}%>
</select>
</td>

//在总jsp中获取值,但国家/地区相同,不采用不同的值

String country=request.getParameter("Country"); 
String country1=request.getParameter("Country");
String country2=request.getParameter("Country");
String country3=request.getParameter("Country");
String country4=request.getParameter("Country");
at URL take values fine but how to get them using request.getParameter?

at URL

最佳答案

使用getParameterValues()它返回一个字符串数组,其中包含所有选定的选项像这样:

String country=request.getParameterValues("Country");

关于java - 获取从一个jsp到另一个jsp生成的多个值数据库下拉列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62350946/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com