Reputation: 1821
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.
If anyone could help to overcome this, I'll be very thankful.
Upvotes: 0
Views: 2250
Reputation: 1108547
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>
Upvotes: 1
Reputation: 37051
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
Upvotes: 3