Ammar
Ammar

Reputation: 1821

Navigation not working in JSF

I'm building an application in JSF with Primefaces 3.1.1. Right now I'm facing a problem regarding navigation. Navigation is not working when I click on the button. I have checked the navigation case in faces-config file, it is fine. Can any body suggest something ?

Button code in page index:

<p:commandButton style="font-size: 20px;" id="login" value="Login" action="valid"/>

faces-config code :

<navigation-rule>
    <from-view-id>/index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>valid</from-outcome>
        <to-view-id>/AdminHome.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

Upvotes: 1

Views: 1463

Answers (1)

Matt Handy
Matt Handy

Reputation: 30025

First of all if you are already on JSF 2.0, you do not need the faces-config.xml for navigation. However, it is not prohibited. Without some code it is hard to guess, but the most likely cause for Primefaces buttons is that they are ajax buttons by default. You have to set ajax=false explicitely for you command button to use it for navigation purposes.

Upvotes: 3

Related Questions