title: How to set a default value in selectOneMenu ? JSF or Primefaces
body: <p>I want to show a Default(selected) Value in a selectOneMenu. In the selectOneMenu i show Person Object from a list. But i want to add a String value like "Please choose a value". And i want to show this String as Default, so that the user have to choose some of the existing Person Object in the Select One Menu. My result is, that the String value "Please choose a value" exists, but it is not as the Default (selected Value).    </p>
  
  <pre><code> &lt;p:selectOneMenu id="emailaddress" value="#{personDataActions.actualPerson}"&gt;
      &lt;f:converter converterId="personConverter" /&gt;
      &lt;f:selectItem itemLabel="Please choose a value" itemValue=""  noSelectionOption="true" /&gt;
  
      &lt;f:selectItems value="#{personDataActions.allPersons}"
      var="person" itemLabel="#{person.emailaddress}" converter="personConverter"/&gt;
  
      &lt;/p:selectOneMenu&gt;
  </code></pre>
  
  <p>My Converter is this: </p>
  
  <pre><code>@FacesConverter(value = "personConverter")
  public class PersonConverter implements Converter {
  
      @Inject
      private PersonDataActions personDataActions;
  
      @Override
      public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
          return personDataActions.getPersonByEmailaddress(arg2);
      }
  
      @Override
      public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
          Person person = (Person) arg2;
          if (person != null) {
              return person.getEmailaddress();
          }
          return null;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>I have followed the example in the other post. but it not works. I see the item, but it is not a Default value. So my unterstanding is, that the value in the select one menu value="#{personDataActions.actualPerson}" is responsible for Setting the Default value. But the value in the select One Menu is a Person Object, and i want to set a String object. How i can handle this ?  </p>