JSF Tip of the Day: Immediate outcomes
Posted by David Chandler on March 30, 2006
Do you ever want to use a button to transition to another view, but don’t need to execute an event handler method? Common examples of this are Cancel and Finished buttons. Rather than writing a dummy method just to return an outcome string that matches a navigation rule, you can simply do this:
<h:commandButton value=”Finish” immediate=”true” action=”return_to_start”/>
When immediate=true, JSF skips the validation, update model, and invoke application phases, so no event handler methods are executed and you specify the outcome string in the action attribute where you would normally put a method binding. To select the next view, JSF will process navigation rules using the outcome as usual.