Problem with Navigation Flow when using <p:commandButton>

UI Components for JSF
Post Reply
KingdomHeart
Posts: 280
Joined: 25 Jun 2010, 01:18

30 Jul 2010, 18:21

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.

Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7

cagatay.civici
Prime
Posts: 17987
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Jul 2010, 22:11

Can you post your navigation-rule configuration?

KingdomHeart
Posts: 280
Joined: 25 Jun 2010, 01:18

31 Jul 2010, 20:08

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>

Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7

cagatay.civici
Prime
Posts: 17987
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Aug 2010, 20:06

Can you try with ajax="false" on commandButton?

KingdomHeart
Posts: 280
Joined: 25 Jun 2010, 01:18

04 Aug 2010, 17:29

Yup, that fix it. Thank you.

Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7

cagatay.civici
Prime
Posts: 17987
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Aug 2010, 12:46

Glad it helped, by the way if you want to keep ajax, you need to redirect not forward.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests