title: JSF 2 : noSelectionOption problem for selectOneMenu with converter
body: <p>Im currently testing the use of <strong>f:selectItems</strong> tag that make use of existing POJO classes.</p>
  
  <h2>This is working fine :</h2>
  
  <p>facelet :</p>
  
  <pre><code>&lt;h:selectOneMenu value="#{selectionLabBean.oneSelectMenuPojo}" 
      converter="heroConverter"&gt;
      &lt;f:selectItems value="#{selectionLabBean.heroList}" 
          var="hero" itemValue="#{hero}" itemLabel="#{hero.name}" /&gt;
  &lt;/h:selectOneMenu&gt;
  </code></pre>
  
  <p>managed bean :</p>
  
  <pre><code>private HeroBean oneSelectMenuPojo;
  public HeroBean getOneSelectMenuPojo() {
      return oneSelectMenuPojo;
  }
  public void setOneSelectMenuPojo(HeroBean oneSelectMenuPojo) {
      this.oneSelectMenuPojo = oneSelectMenuPojo;
  }
  </code></pre>
  
  <h2>And then, i want to add "Choose one .." selection, i did this :</h2>
  
  <p>facelet :</p>
  
  <pre><code>&lt;h:selectOneMenu value="#{selectionLabBean.oneSelectMenuPojo}" 
      converter="heroConverter"&gt;
      &lt;f:selectItem itemValue="NONE" itemLabel="Choose one .." 
          noSelectionOption="true"/&gt;
      &lt;f:selectItems value="#{selectionLabBean.heroList}" 
          var="hero" itemValue="#{hero}" itemLabel="#{hero.name}" /&gt;
  &lt;/h:selectOneMenu&gt;
  </code></pre>
  
  <p>and this will exception happens :</p>
  
  <blockquote>
    <p>java.lang.ClassCastException: java.lang.String cannot be cast to user.ui.HeroBean</p>
  </blockquote>
  
  <p>I think i understand the problem. Im using converter to map POJO to selection and the other way around and the "Choose one" maps to a String. But i also want to put the string of "Choose one ..". What can i do to solve this problem ?</p>
  
  <p>Here's my converter class :</p>
  
  <pre><code>@FacesConverter("heroConverter")
  public class HeroBeanConverter implements Converter {
      @Override
      public Object getAsObject(FacesContext context, UIComponent ui, 
          String newValue) {
          return HeroBean.findHeroBeanByName(newValue);
      }
  
      @Override
      public String getAsString(FacesContext context, UIComponent component,
          Object value) {
          return ((HeroBean) value).getName();
      }
  }
  </code></pre>