Reputation: 325
I currently have a JSP with a select that looks like this:
<select name="withoutAccess" size="5">
<c:foreach var="item" items="${obj.withoutAccess}">
<option>${item}</option>
</c:foreach>
</select>
For the sake of clarity, I'll only post the select list, as the rest works well.
Now, in my form, when I click the submit button, I want to catch all values in the select list in the other page.
I'm only managing to obtain the option that is selected in that list when I press the button.
How can I obtain the rest?
I've tried with request.getParameterValues("withoutAccess"), but it has only 1 option, the one that is selected.
Upvotes: 2
Views: 917
Reputation: 325
Well, I found one solution.
Create a javascript script that puts all options with selected = true, that way I can catch them in the request :)
Upvotes: 0
Reputation: 56779
Only the selected options ever get sent in a form post. If you want to get the entire list of options, you need to look them up again (i.e., from the database), or store them in a persistent storage location such as session or application state.
Upvotes: 1