0

I'm using JSF 2.0 in my web project. But navigation is not working properly, in my case. I think this problem arose due to changes in hierarchy of the files because action method is working fine. I'm attaching the snapshot to give idea about files' hierarchy.

enter image description here

If anyone could help to overcome this, I'll be very thankful.

Ammar
  • 1,811
  • 5
  • 26
  • 60

2 Answers2

3

You have to add ajax="false" to you primefaces commandButtons in order to perform navigation or use the simple <h:commandButton ...

if you want to use primefaces ajax button , you should sue redirect then,

like this

 <p:commandButton action="home?faces-redirect=true" value="Redirect to home"/>

also look a t similar question over here:

PrimeFaces commandButton doesn't navigate or update

Community
  • 1
  • 1
Daniel
  • 36,833
  • 10
  • 119
  • 200
1

Upgrade to PrimeFaces 3.2. Then you'll be able to navigate by ajax. The update/render of @all was not supported before that version. If you can't upgrade, then you need to bring in the following JavaScript hack:

var originalPrimeFacesAjaxResponseFunction = PrimeFaces.ajax.AjaxResponse;
PrimeFaces.ajax.AjaxResponse = function(responseXML) {
    var newViewRoot = $(responseXML.documentElement).find("update[id='javax.faces.ViewRoot']").text();

    if (newViewRoot) {
        document.open();
        document.write(newViewRoot);
        document.close();
    }
    else {
        originalPrimeFacesAjaxResponseFunction.apply(this, arguments);
    }
};

Put this in a .js file which you import in the very end of the <h:head> tag. E.g.

<h:head>
    ...
    <h:outputScript name="js/primeFacesAll.js" />
</h:head>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555