简体   繁体   中英

get multiple values database generated drop down from one jsp to other

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> 

//getting values at total jsp but country is same not taking distinct values

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

Use the getParameterValues() it returns a String array with all the option selected like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM