title: How to set default value to <h:selectOneMenu>
body: <p>I am trying to set default value to h:selectOneMenu. But, It is not working. </p>
  
  <p>This is my code</p>
  
  <p><strong>index.xhtml</strong></p>
  
  <pre><code>&lt;h:body&gt;
          &lt;h:form id="test"&gt;
          &lt;h:selectOneMenu value="#{selectMenuBean.selectedItem}"
                           title="select version"
                           onchange="submit()"
                           disabled="false" id="combo"&gt;
  
              &lt;f:selectItems value="#{selectMenuBean.selectItems}" /&gt;
          &lt;/h:selectOneMenu&gt;
  
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  </code></pre>
  
  <p><strong>BackingBean</strong></p>
  
  <pre><code>private String selectedItem;
  private List selectItems;
  private int version=3;
  
  public List getSelectItems() {
  
      List&lt;Version&gt; selectedItems = ExportDao.getVersionsList();
      System.out.println("List size: "+selectedItems.size());
      selectItems = new ArrayList();
  
      for (Version v1 : selectedItems) {
          String DATE_FORMAT = "yyyy-MM-dd HH:mm";
          //Create object of SimpleDateFormat and pass the desired date format.
          SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
          selectItems.add(new SelectItem(v1.getVersion(), "V" + v1.getVersion() + "/" + sdf.format(v1.getDate())));
          if(version = v1.getVersion()) // I have to check the version and set the matching version as selected.
          selectedItem = "V" + v1.getVersion() + "/" + sdf.format(v1.getDate());
  
      }
      return selectItems;
  }
  </code></pre>