title: make request parameter value as selected in dropdown when page load in jsp
body: <p>in the session i have a string like "apple" when i go to other page in that dynamic dropdown is there, by default dropdown list should compare with session string i.e "apple" if it found in that list make that as selected. please help me </p>
  
  <p>for Example see below, this is dynamic dropdown fetched from db with sql query <strong>select fruit from foods</strong> 
  Connection conn = null;</p>
  
  <pre><code>conn = new DBConnection().getMyConnection();
  PreparedStatement ps = conn.prepareStatement("select fruit from foods");
  ResultSet rs = ps.executeQuery();
  Select Fruit : &lt;select name="fruit" id="fruit"&gt; 
          &lt;% while (rs.next()) { %&gt;
              &lt;option value="0"&gt;select fruit&lt;/option&gt;
              &lt;option value="&lt;%=rs.getString("fruit")%&gt;"&gt;
              &lt;%=rs.getString("fruit")%&gt;&lt;/option&gt;
  &lt;/select&gt;
  
  **output:**
  
      &lt;select name="fruit" id="fruit"&gt;
      &lt;option value="0"&gt;select fruit&lt;/option&gt;
      &lt;option value="banana"&gt;banana&lt;/option&gt;
      &lt;option value="apple"&gt;apple&lt;/option&gt;
      &lt;option value="guva"&gt;guva&lt;/option&gt;
      &lt;option value="orange"&gt;orange&lt;/option&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>when i load the page by default it should be like below dropdown i.e, apple should be selected:
  <strong>Expected Output :</strong></p>
  
  <pre><code>   &lt;select name="fruit" id="fruit"&gt;
      &lt;option value="apple"&gt;apple&lt;/option&gt;
      &lt;option value="0"&gt;select fruit&lt;/option&gt;
      &lt;option value="banana"&gt;banana&lt;/option&gt;
      &lt;option value="guva"&gt;guva&lt;/option&gt;
      &lt;option value="orange"&gt;orange&lt;/option&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>Thanks in advance :-)</p>