Hey all,
I have a JSF application that consists of two JSPs: login.jsp & main.jsp.
I have the following faces-config.xml:
<lifecycle>
<phase-listener>package.programs.scorecard.beans.EventBean</phase-listener>
</lifecycle>
<managed-bean>
<managed-bean-name>FormBean</managed-bean-name>
<managed-bean-class>package.programs.scorecard.beans.FormBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>DataBean</managed-bean-name>
<managed-bean-class>package.programs.scorecard.beans.DataBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>EventBean</managed-bean-name>
<managed-bean-class>package.programs.scorecard.beans.EventBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
And the following web.xml:
<welcome-file-list>
<welcome-file>faces/login.jsp</welcome-file>
<welcome-file>faces/index.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
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.
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.
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.
I have been trying to debug this for a couple of hours this morning, and I welcome any suggestions or insights.
UPDATE: 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:
<h:selectOneMenu id="ddlManager" value="#{DataBean.managerId}">
<f:selectItems value="#{DataBean.managerList}" />
</h:selectOneMenu>
Where managerList is a list of SelectItem objects.