title: HTML Select Box, selected data from servlet
body: <p>Good day!</p>
  
  <p>I am having a problem with the select box in html. I am on the EDIT portion of my simple CRUD project and before users can edit, the chosen data will be shown first and I retrieved it in the database through the servlet.</p>
  
  <p>Now I want the data I retrieve be the one SELECTED (default) in my select box. <code>${product.category}</code></p>
  
  <pre><code>&lt;select size="1" name="category"&gt;
          &lt;option value ="1"&gt;Dogs&lt;/option&gt;
          &lt;option value ="2"&gt;Cats&lt;/option&gt;
          &lt;option value ="5"&gt;Others&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I tried inserting it like this but it doesn't work.</p>
  
  <pre><code>&lt;select size="1" name="category" selected=${product.category}&gt;
          &lt;option value ="1"&gt;Dogs&lt;/option&gt;
          &lt;option value ="2"&gt;Cats&lt;/option&gt;
          &lt;option value ="5"&gt;Others&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I want to do something like this.. If (${product.category}==1), selected=option 1... </p>
  
  <p>I've seen something like <a href="https://stackoverflow.com/questions/3747212/html-select-box-set-the-option-on-selected-with-help-php">THIS</a> in one of the forums but it is in PHP format. How can I do it using JSP?</p>
  
  <p>Thank you very much.</p>