title: JSF commandLink action firing before Updating Model Values
body: <p>I have a JSF application that consists of two JSPs: login.jsp &amp; main.jsp.</p>
  
  <p>I have the following faces-config.xml:</p>
  
  <pre><code>&lt;lifecycle&gt;
    &lt;phase-listener&gt;package.programs.scorecard.beans.EventBean&lt;/phase-listener&gt;
  &lt;/lifecycle&gt;
  &lt;managed-bean&gt;
    &lt;managed-bean-name&gt;FormBean&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;package.programs.scorecard.beans.FormBean&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
  &lt;/managed-bean&gt;
  &lt;managed-bean&gt;
    &lt;managed-bean-name&gt;DataBean&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;package.programs.scorecard.beans.DataBean&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
  &lt;/managed-bean&gt;
  &lt;managed-bean&gt;
    &lt;managed-bean-name&gt;EventBean&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;package.programs.scorecard.beans.EventBean&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
  &lt;/managed-bean&gt;  
  </code></pre>
  
  <p>And the following web.xml:</p>
  
  <pre><code>&lt;welcome-file-list&gt;
    &lt;welcome-file&gt;faces/login.jsp&lt;/welcome-file&gt;
    &lt;welcome-file&gt;faces/index.jsp&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;servlet&gt;
    &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
    &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>I have a couple of components on login.jsp that update properties in DataBean on a commandLink click. Upon successful completion, the user is navigated to /main.jsp.</p>
  
  <p>I notice that when I click the commandLink, the method executes BEFORE the bean is updated. This results in all of my bean properties to be null when the method executes because the values from my form are not being applied to the bean.</p>
  
  <p>From what I understood of the JSF life cycle, the "Update Model Values" should always be executed before "Invoke Application" unless "immediate=true" is specified, which it is not for my commandLink.</p>
  
  <p>I have been trying to debug this for a couple of hours this morning, and I welcome any suggestions or insights.</p>
  
  <p><strong>UPDATE</strong>: 
  I have investigated this issue thoroughly and have concluded that the drop down component I was utilizing has a bug in it that should be fixed in the next release. My solution was to use a regular h:selectOneMenu in lieu of the third party component, and it works like a charm:</p>
  
  <pre><code>&lt;h:selectOneMenu id="ddlManager" value="#{DataBean.managerId}"&gt;
      &lt;f:selectItems value="#{DataBean.managerList}" /&gt;
  &lt;/h:selectOneMenu&gt;
  </code></pre>
  
  <p>Where managerList is a list of SelectItem objects.</p>