title: How to set <option selected> based on an ArrayList?
body: <p>I have 2 arraylists in JSP that are passed from controller servlet: <code>allOptionsList</code> and <code>alreadySelectedOptionsList</code>.</p>
  
  <p>I am trying to generate HTML form with <code>&lt;select&gt;</code> dropdown and I want to show all items from <code>allOptionsList</code> as an <code>&lt;option&gt;</code> within <code>&lt;select&gt;</code> but, I want for items that are in <code>alreadySelectedOptionsList</code> to be shown as <code>&lt;option selected="selected"&gt;</code>.</p>
  
  <p>This is what I already have:</p>
  
  <pre><code>&lt;select name="options" size="20"&gt;
       &lt;c:forEach items="${allOptionsList}" var="optionAll"&gt;
          &lt;option&gt;${optionAll.optionName}&lt;/option&gt;
       &lt;/c:forEach&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Basicly I want for option is to be selected if it is already in the <code>alreadySelectedOptionsList</code> list. How can I achieve this?</p>