I have an HTML select box in my JSP page that allows multiple selections.
<form action="resources" method="post" >
<select name="frmSelectedResources" multiple="multiple">
<option value="1">Bill</option>
<option value="3">Kathy</option>
<option value="18">Mike</option>
</select>
</form>
In my Java servlet I can get the values of the select resources with:
String[] assignedResources = request.getParameterValues("frmSelectedResources");
Which give me a string array of 1,3,18. But how can I retrieve the text for each of these values?
I need to get back something like this: (1,Bill), (3, Kathy), (18, Mike)
What I’m trying to do is rebuild the Selected Resource list when I’m doing forms validation and the user made a data entry error elsewhere on the form.
Thanks in advance for any help or suggestions.
You can’t receive it from request parameter (unless you explicitly set it), Browser only sends the value of select item not the label, it uses label just to display
Have a map that resolves label from value received