Recently I have seen a thread on OTN forum in that user want to navigate from one page to another on valueChangeListener of input component.
First Method-
This is a simple piece of code to perform navigation to specific page , Use it in ValueChangeListener directly
Second Method-
ValueChangeListener fires when value of input component changes but it is not meant for navigation, For navigation we use buttons and links with Action property
But for this requirement we have to be a bit tricky, We can queue button Action on value change listener of inputText to navigate to another page
Now first value change listener will be executed and then it'll queue button action to execute and as final outcome user will be able to navigate
First Method-
This is a simple piece of code to perform navigation to specific page , Use it in ValueChangeListener directly
FacesContext facesContext = FacesContext.getCurrentInstance(); facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, null, "controlFlowName");
Second Method-
ValueChangeListener fires when value of input component changes but it is not meant for navigation, For navigation we use buttons and links with Action property
But for this requirement we have to be a bit tricky, We can queue button Action on value change listener of inputText to navigate to another page
Now first value change listener will be executed and then it'll queue button action to execute and as final outcome user will be able to navigate