handling multiple select in JSP
Hi,
When I use request.getParameters to read from values passed in a multple select form element, I only ever get the first element. How do I handle multple select elements in jsp?
Example:
My HTML form:
<html>
<body>
<form name="testForm" method="post" action="testJSP.jsp">
<select name="testList" multiple="true">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input type="submit">
</form>
</body>
</html>
--
My JSP action page:
<%
String sValue = request.getParameter("testList");
%>
<html>
<body>
<%
out.print(sValue);
%>
</body>
</html>
-
No matter how many values I select in the select box, the only value that will ever get printed out is the first selected value.
Using HTTPWatch, it seems that all values are passed independantly, with the same parameter name. (e.g. testList: 1, testList: 2, testList: 3) instead of a comma delimited string (1,2,3).
How can I handle this?
Thanks!

