title: How to use enum values in f:selectItem(s)
body: <p>I want to make a selectOneMenu dropdown so I can select a status on my question. Is it possible to make the f:selectItem more flexible considering what happens if the order of the enums changes, and if the list was large? And could I do this better? And is it possible to automatically "select" the item that the question have?</p>
  
  <p><strong>Enum class</strong></p>
  
  <pre><code>public enum Status {
      SUBMITTED,
      REJECTED,
      APPROVED
  }
  </code></pre>
  
  <p><strong>Question entity</strong></p>
  
  <pre><code>@Enumerated(EnumType.STRING)
  private Status status;
  </code></pre>
  
  <p><strong>JSF</strong></p>
  
  <pre><code>&lt;div class="field"&gt;
      &lt;h:outputLabel for="questionStatus" value="Status" /&gt;
      &lt;h:selectOneMenu id="questionStatus" value="#{bean.question.status}" &gt;
          &lt;f:selectItem itemLabel="Submitted" itemValue="0" /&gt;
          &lt;f:selectItem itemLabel="Rejected" itemValue="1" /&gt;
          &lt;f:selectItem itemLabel="Approved" itemValue="2" /&gt;
      &lt;/h:selectOneMenu&gt;
      &lt;hr /&gt;
  &lt;/div&gt;
  </code></pre>