JSF navigation on commandbutton

Posted by Nitesh Panchal on Stack Overflow See other posts from Stack Overflow or by Nitesh Panchal
Published on 2010-03-16T12:25:26Z Indexed on 2010/03/16 12:26 UTC
Read the original article Hit count: 194

Filed under:

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?

© Stack Overflow or respective owner

Related posts about jsf