Page 1 of 1

Problem with Navigation Flow when using <p:commandButton>

Posted: 30 Jul 2010, 18:21
by KingdomHeart
When I implement navigation flow with <p:commandButton>, I got an error

Code: Select all

<p:commandButton action="#{document.createNewFacility}"  value="Add New Facility" rendered="#{document.displayFacility}" />
//This should take me to NewFacility.xml

Code: Select all

Unable to find matching navigation case with from-view-id '/NewFacility.xhtml' for action '#{document.createNewFacility}' with outcome 'NEW FACILITY'
However, if I change the <p:commandButton> to <h:commandButton> then it work fine.

Code: Select all

    public String createNewFacility(){
        return "NEW FACILITY";        
    }
Note here that I use "action", not "actionListener", so in theory it should work, unless "action" attribute in <p:commandButton> no longer mean what I think it suppose to mean.

Re: Problem with Navigation Flow when using <p:commandButton

Posted: 30 Jul 2010, 22:11
by cagatay.civici
Can you post your navigation-rule configuration?

Re: Problem with Navigation Flow when using <p:commandButton

Posted: 31 Jul 2010, 20:08
by KingdomHeart
This is a portion of my navigation flow. The <p:commandButton> is inside DisplayList.xhtml, and I am trying to go to NewFacility.xhtml

Code: Select all

    <navigation-rule>
        <from-view-id>/DisplayList.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>LOGOUT</from-outcome>
            <to-view-id>/Logout.xhtml</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>DETAILS</from-outcome>
            <to-view-id>/DisplayDetails.xhtml</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>NEW CUSTOMER</from-outcome>
            <to-view-id>/NewCustomer.xhtml</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>NEW FACILITY</from-outcome>
            <to-view-id>/NewFacility.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>

Re: Problem with Navigation Flow when using <p:commandButton

Posted: 01 Aug 2010, 20:06
by cagatay.civici
Can you try with ajax="false" on commandButton?

Re: Problem with Navigation Flow when using <p:commandButton

Posted: 04 Aug 2010, 17:29
by KingdomHeart
Yup, that fix it. Thank you.

Re: Problem with Navigation Flow when using <p:commandButton

Posted: 05 Aug 2010, 12:46
by cagatay.civici
Glad it helped, by the way if you want to keep ajax, you need to redirect not forward.