2

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?

pnuts
  • 58,317
  • 11
  • 87
  • 139
user3505775
  • 339
  • 2
  • 6
  • 20

2 Answers2

2

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

user1012506
  • 2,048
  • 1
  • 26
  • 45
1

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.

vssk
  • 445
  • 3
  • 7