0

Hi i would go through steps of flow in backing bean using a method:

transition(FacesContext context, Flow sourceFlow, Flow targetFlow, FlowCallNode outboundCallNode, String toViewId);

of

javax.faces.flow.FlowHandler 

or some other way

for example:

public void startFlow(){

    // in this example we dont use jsf tags 
    // (<h:commandButton /> and <h:commandLink />) to navigate user through flow steps

    FlowHandler handler = context.getApplication().getFlowHandler();
    Flow targetFlow = handler.getFlow(context, "", "registerFlow");
    boolean isAdmin = checkIfAdmin();

    if(isAdmin){
      // here we forward user to viewNode of flow that name step1
      handler.transition(context, null, targetFlow, null, "step1");
    }
    else{
      // here we forward user to viewNode of flow that name step1ForAdmin
      handler.transition(context, null, targetFlow, null, "step1ForAdmin");
    }

}

It is possible to do that in backing bean? or meaby is other way to do that?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Michał Ziembiński
  • 1,124
  • 2
  • 10
  • 31

1 Answers1

0

FlowHandler is an abstract class, which is intended for internal use of the JSF framework. If you want to navigate to one or another entry node of a JSF flow simply return the name of the target node for navigation (Only HTTP POST is allowed). Or you can enter into the flow through a Method Call Node or a Switch Node and implement there the required navigation conditions.

You can read this Post and download the sample project from GitHub. It will illustrate you on some techniques related to JSF flows.

Javier Haro
  • 1,255
  • 9
  • 14