Event and Listener Execution Order
There is a specific order in which the events and listeners are executed. The validators are fired first within the Process Validation phase of the JSF life cycle. The next phase is the Invoke Application phase that handles all of the events and listeners.
The value change listeners are executed first, followed by the action listeners. Last to be executed is the action method, because that is what determines navigation. Any of these listeners can raise a AbortProcessingException to abort the process.
If an action listener raises an exception, it doesn’t prevent navigation. In most cases, however, you would not want to navigate, but rather redisplay the page with an error message. To implement that behavior, in the action property you can call a method that returns null if there is an exception, but otherwise returns the String outcome to use for navigation.
For example, the selectWhere() method referenced in the Action property of the Update Order button shown in the slide may contain code to navigate to a manager task flow call if the value of the order is over a certain amount, or to a commit method for an order below that amount. The navigation is dependent on the String outcome returned by the selectWhere() method.