JSF navigation on commandbutton
- by Nitesh Panchal
Hello,
I want to conditionally navigate to some page. If some condition is true i want to navigate to some other page else i want to remain on the same page. I have something like :-
<h:commandButton action="#{bean.navigate}"/>
in bean.navigate i have something like :-
public String navigate(){
if(value <= 0)
return "helloWorld";
else
return "";
}
But if i return "", error is thrown and in h:messages message is appended that page not found etc. How do i avoid this error?