title: JSF 2: access selected value of selectOneMenu in a form BEFORE submit
body: <p><strong>VIEW</strong></p>
  
  <pre><code>&lt;h:form id="main_form"&gt;
      &lt;p:inputText id="title" required="true" label="Title" value="#{myBean.myLink.title}" immediate="true" /&gt;
  
      &lt;p:selectOneMenu id="scope" required="true" label="Scope" value="#{myBean.myLink.scope}" immediate="true" &gt;
          &lt;f:selectItem itemLabel="Please choose" itemValue="" /&gt;
          &lt;f:selectItems value="#{myBean.availableScopes}" id="selScope"/&gt;
      &lt;/p:selectOneMenu&gt;
  
      &lt;p:inputText id="link" required="true" label="URL" value="#{myBean.myLink.link}" immediate="true"&gt;      
          &lt;p:ajax event="blur" update="msgLink" listener="#{myBean.checkUrl}" /&gt;
      &lt;/p:inputText&gt;
  
      ... msgLink and other (required) elements
  
      ... submit button
  &lt;/h:form&gt;
  </code></pre>
  
  <p><strong>Managed Bean</strong></p>
  
  <pre><code>@Component("myBean")
  @Scope("session")
  public class MyBean implements Serializable {
  
      private Link myLink;
      private Map&lt;String, String&gt; availableScopes;
  
      public MyBean() {
          this.availableScopes = new HashMap&lt;String, String&gt;();
          this.availableScopes.put("Intranet", "Intranet");
          this.availableScopes.put("Internet", "Internet");   
      }
  
      // setter/getters etc.
  
      public void checkUrl() {
          System.out.println(myLink.getTitle());  // works
          System.out.println(myLink.getScope());  // DOES NOT work
          System.out.println(myLink.getLink());   // works
      }
  
  }
  </code></pre>
  
  <ul>
  <li>I want to check the URL depending of the selected scope <strong>before</strong> submitting the form. But the called method can access the <code>inputText</code> values of the object. Not the value chosen in <code>selectOneMenu</code>. </li>
  <li>I have tried it with <code>getExternalContext().getSessionMap().get("scope")</code> but the SessionMap is null at that time.</li>
  </ul>
  
  <p>Any chance to access the selected value of the combo box?</p>
  
  <p>Thanks
  Jim</p>