title: Java servlet - Retrieve text and value from an HTML select multiple
body: <p>I have an HTML select box in my JSP page that allows multiple selections.</p>
  
  <pre><code>&lt;form action="resources" method="post" &gt;
      &lt;select name="frmSelectedResources" multiple="multiple"&gt;
          &lt;option value="1"&gt;Bill&lt;/option&gt;
          &lt;option value="3"&gt;Kathy&lt;/option&gt;
          &lt;option value="18"&gt;Mike&lt;/option&gt;
      &lt;/select&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>In my Java servlet I can get the values of the select resources with:</p>
  
  <pre><code>String[] assignedResources = request.getParameterValues("frmSelectedResources");
  </code></pre>
  
  <p>Which give me a string array of 1,3,18. But how can I retrieve the text for each of these values?</p>
  
  <p>I need to get back something like this: (1,Bill), (3, Kathy), (18, Mike)</p>
  
  <p>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.</p>
  
  <p>Thanks in advance for any help or suggestions.</p>