title: Display Selected Data from database in drop down list
body: <p>My goal is to selected data in database and display in drop down list.</p>
  
  <p>For example, see the image below show that fbMenuId = M001 (Lasagne).</p>
  
  <p><img src="https://i.stack.imgur.com/pZWfC.jpg" alt="database1"></p>
  
  <p>So at dropdownlist M001 option will be selected. I also need display OTHER MENU like M002,M003,M004,M005,M006 and M007. For example, see the image below</p>
  
  <p><img src="https://i.stack.imgur.com/74Rc3.jpg" alt="database"></p>
  
  <p>However, my outcome is </p>
  
  <p><img src="https://i.stack.imgur.com/rwXhI.png" alt="ddl"></p>
  
  <p>Below are my codes</p>
  
  <pre><code>&lt;select class="form-control" name="menu" id="menu"&gt;
                                              &lt;option value="${order.fbMenuId}" selected&gt;${order.fbMenuName}&lt;/option&gt;
                                              &lt;c:forEach var="menu" items="${menu}"&gt;
                                                  &lt;option value="${menu.fbMenuId}"&gt;${menu.fbMenuName}&lt;/option&gt;
                                              &lt;/c:forEach&gt;
  
  &lt;/select&gt;
  </code></pre>
  
  <p>I am able to display M001 Lasagne. However, there are 2 Lasagne which I do not want. Anyone please help me. Help will be appreciate. Thanks in advance!</p>
  
  <p>Below are codes for servlet and data access object.</p>
  
  <p><strong>Servlet</strong> </p>
  
  <pre><code>OrderDAO dao = new OrderDAO();
  request.setAttribute("order", dao.getOrder(fbOrderId));
  request.setAttribute("menu", dao.getMenu(restaurant));
  </code></pre>
  
  <p><strong>OrderDAO</strong></p>
  
  <pre><code>public OrderBean getOrder(Integer fbOrderId) {
  
              OrderBean ob = new OrderBean();
              try {
                  currentCon = ConnectionManager.getConnection();
                  Statement statement = currentCon.createStatement();
                  ResultSet rs = statement.executeQuery("SELECT fborders.fbMenuId, fbMenuName FROM fborders INNER JOIN fbmenu ON fborders.fbMenuId = fbmenu.fbMenuId WHERE fbOrderId='"+ fbOrderId + "'");
  
                  while (rs.next()) {
                      ob.setFbMenuId(rs.getString("fbMenuId"));
                      ob.setFbMenuName(rs.getString("fbMenuName"));
                  }
  
              } catch (SQLException e) {
                  e.printStackTrace();
              }
  
              return ob;
          }
  
  
  
  public ArrayList getMenu(String restaurant) {
  
          ArrayList&lt;OrderBean&gt; am = new ArrayList&lt;OrderBean&gt;();
          try {
              currentCon = ConnectionManager.getConnection();
              Statement statement = currentCon.createStatement();
              ResultSet rs = statement
                      .executeQuery("SELECT fbMenuId, fbMenuName FROM fbmenu WHERE fbRestaurantId='"
                              + restaurant + "'");
  
              while (rs.next()) {
                  OrderBean ob = new OrderBean();
                  ob.setFbMenuId(rs.getString("fbMenuId"));
                  ob.setFbMenuName(rs.getString("fbMenuName"));
                  am.add(ob);
              }
  
          } catch (SQLException e) {
              e.printStackTrace();
          }
  
          return am;
      }
  </code></pre>