my javascript is
function takeListBoxValue()
{
document.frmPartnerList.submit();
var selectArray = new Array();
for (i = 0; i < partnerList.length; i++)
{
selectArray[i] = new Array();
selectArray[i][0] = partnerList.options[i].text;
selectArray[i][1] = partnerList.options[i].value;
}
document.frmPartnerList.<%=RateCardConstant.ACTION_MODE_PARAMETER%>.value='<%=(new Long(RateCardActionConstant.PARTNER_DOMAIN_LIST_ACTION).toString())%>&dataValue='+selectArray;
}
You don't need JS for this. Just HTML is enough.
<form action="servleturl" method="post">
<select name="listbox" multiple="true">
<option value="value1">label1</option>
<option value="value2">label2</option>
<option value="value3">label3</option>
</select>
<input type="submit">
</form>
And then in the servlet use HttpServletRequest#getParameterValues()
to obtain the selected values:
String[] listbox = request.getParameterValues("listbox");
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.