If the outcome in an unbounded task flow is to be decided based on some user input, then we can use below code to decide which control flow case to follow. In this example the navigation to another page is decided by the user action on the popup. If user press OK the control flow case is followed.
First configure the dialog listener of the dialog used in the popup to capture the DialogEvent in a managed bean.
public void confirmAction(DialogEvent dialogEvent)
{
DialogEvent.Outcome result = dialogEvent.getOutcome();
if (result == DialogEvent.Outcome.ok)
{
NavigationHandler navigationHandler = FacesContext.getCurrentInstance().getApplication().getNavigationHandler(); navigationHandler.handleNavigation( FacesContext.getCurrentInstance(), null, "Control_Flow_Case");
}
}
Here Control_Flow_Case can be based on some user input as well. However NavigationHandler can't be used in case of bounded task flow. In that case, we will need to set the viewId on the ViewPort that can be accessed through ControllerContext.
First configure the dialog listener of the dialog used in the popup to capture the DialogEvent in a managed bean.
public void confirmAction(DialogEvent dialogEvent)
{
DialogEvent.Outcome result = dialogEvent.getOutcome();
if (result == DialogEvent.Outcome.ok)
{
NavigationHandler navigationHandler = FacesContext.getCurrentInstance().getApplication().getNavigationHandler(); navigationHandler.handleNavigation( FacesContext.getCurrentInstance(), null, "Control_Flow_Case");
}
}
Here Control_Flow_Case can be based on some user input as well. However NavigationHandler can't be used in case of bounded task flow. In that case, we will need to set the viewId on the ViewPort that can be accessed through ControllerContext.
No comments:
Post a Comment