0

嗨,我将使用一种方法完成支持 bean 的流程步骤:

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

javax.faces.flow.FlowHandler 

或其他方式

例如:

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");
    }

}

可以在支持bean中做到这一点吗?或者 meaby 是其他方法吗?

4

1 回答 1

0

FlowHandler 是一个抽象类,旨在供 JSF 框架内部使用。如果要导航到 JSF 流的一个或另一个入口节点,只需返回目标节点的名称以进行导航(仅允许 HTTP POST)。或者您可以通过方法调用节点或切换节点进入流程并在那里实现所需的导航条件。

您可以阅读这篇文章并从 GitHub 下载示例项目。它将向您说明一些与 JSF 流相关的技术。

于 2015-09-23T10:10:30.513 回答