title: Get SelectOneMenu 's selected item from code
body: <p>I'm trying to get a primefaces SelectOneMenu selected item's name from code:</p>
  
  <p>This is my SelectOneMenu:</p>
  
  <pre><code>FacesContext.getCurrentInstance().getViewRoot().findComponent("formMain:somSelect");
  </code></pre>
  
  <p>The Component is found.
  I already tried to cast it into a SelectOneMenu but I won't get a method like "getSelectedValue()" which is written in the user manual in "client side api".
  I also tried:</p>
  
  <pre><code>FacesContext.getCurrentInstance().getViewRoot().findComponent("formMain:somSelect").getAttributes().get("label");
  </code></pre>
  
  <p>But this returns NPE.</p>
  
  <pre><code>&lt;p:selectOneMenu id="somSelect" value="#{userManagerBean.somValue}" valueChangeListener="#{userManagerBean.somListener}" styleClass="selecters"&gt;
  &lt;f:selectItems value="#{userSelectBean.userList}" /&gt;
  &lt;/p:selectOneMenu&gt;
  </code></pre>
  
  <p>UserManagerBean.java</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class UserManagerBean {
  
      private String somValue;
      private String selectedUser;
      private List&lt;User&gt; userData;    
      private List&lt;User&gt; users;
  
      public UserManagerBean() {  
  
      }
  
      public String getSomValue(){
          return somValue;        
      }
  
      public void setSomValue(String somValue){
          this.somValue = somValue;
      }
  
      // Getter for Table Content
      public List&lt;User&gt; getUserData() {
          return userData;
      }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><strong>€: The problem is that the selected item is only returned in the getter if I call a method and an ajax update:</strong></p>
  
  <pre><code>&lt;p:ajax update="panelMain" listener="#{userManagerBean.changeEvent}" /&gt;
  </code></pre>
  
  <p>But I don't get an correct selected item on page load ( item = null ).</p>