Redirect to another view on the same taskflow programatically on ADF

2.1k views Asked by At

I have one taskflow and have two views like this image:

Example of two views

I have a button to go there, but I don't need to click the button. I need to redirect programmatically to another view with calling the action.

How to call it, because I am using JSFF as a page?

If I use this method:

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

I get an error like can't find the component. If I use page template id I also get an error like the compiler can't find the component.

Do you have another method to solve this, or can you fix it if I get wrong find component?

2

There are 2 answers

0
user1012506 On BEST ANSWER

You have use "URL view" and redirect it to your path :enter image description here

0
vssk On

For such case i use this code:

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

where redirect param is a name of flow case rule.