title: Use Select2 with Struts
body: <p>I have Struts 1 app with jsp and I want to prefill select2 (multiple) component in jsp. I have following code, which displays functional Select2 component:</p>
  
  <pre><code>&lt;html:select property="codes" styleClass="myClass" styleId="myId" multiple="multiple"&gt;
      &lt;c:forEach var="csOption" items="${codesList}" varStatus="index"&gt;  
          &lt;html-el:option key="${csOption}" value="${csOption}"/&gt;
      &lt;/c:forEach&gt;
  &lt;/html:select&gt; 
  
  ...
  
  $(".js-example-basic-multiple").select2();
  </code></pre>
  
  <p>In the result, I want to have something like this:</p>
  
  <pre><code>&lt;select ...&gt;
     &lt;option value="A"&gt;A&lt;/option&gt;
     &lt;option value="B"&gt;B&lt;/option&gt;
     &lt;option value="C" selected&gt;C&lt;/option&gt;
     &lt;option value="D" selected&gt;D&lt;/option&gt;
     &lt;option value="E"&gt;E&lt;/option&gt;
  &lt;/select&gt; 
  </code></pre>
  
  <p>However, I want to have some values selected (we are in edit form). In case I add <code>selected="true"</code> into the <code>html:option</code> tag, there is following issue (using only <code>selected</code> does not work as well):</p>
  
  <blockquote>
    <p>Attribute selected invalid for tag option according to TLD</p>
  </blockquote>
  
  <p>Any idea how to solve this?</p>