在ADF上以编程方式重定向到同一任务流上的另一个视图

时间:2016-05-10 09:56:15

标签: jsf-2 jsf-2.2 oracle-adf adf-task-flow

我有一个任务流,有两个像这样的图像:

Example of two views

我有一个按钮去那里,但我不需要点击按钮。我需要通过调用操作以编程方式重定向到另一个视图。

如何调用它,因为我使用JSFF作为页面?

如果我使用这种方法:

       FacesContext fctx = FacesContext.getCurrentInstance();
   UIViewRoot root = fctx.getViewRoot();
   //client Id of button includes naming container like id of region. 
   RichCommandButton button = 
       (RichCommandButton) root.findComponent("cb1");
   ActionEvent actionEvent = new ActionEvent(button);
   actionEvent.queue();
   }

我收到一个无法找到组件的错误。如果我使用页面模板ID,我也会收到错误,例如编译器无法找到该组件。

你有另一种方法可以解决这个问题,或者如果我找错了找到组件你能解决吗?

2 个答案:

答案 0 :(得分:2)

您已使用"网址视图"并将其重定向到您的路径:enter image description here

答案 1 :(得分:1)

对于这种情况,我使用此代码:

public static void navigateTo(String redirect) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
    nh.handleNavigation(facesContext, null, redirect);
}

其中redirect参数是流案例规则的名称。