PrimeFaces commandButton doesn't navigate or update

primefaces commandbutton ajax event
primefaces button'' onclick
primefaces commandbutton update multiple components
primefaces commandbutton actionlistener not called
primefaces commandbutton style
jsf commandbutton action not working
primefaces ajax update
primefaces showcase

I'am using Primefaces to make my app a little bit more beautiful. I noticed that p:commandButton and h:commandButton don't work the same way.

The p:commandButton calls the method and nothing else hapens. The h:commandButton calls the method and returns a navigation.

I have got trouble with redirecting after pressing the login button when using p:commandButton. How to deal with that?

I do have an update parameter:

<p:commandButton value="Login" action="#{login.login}" type="submit" update="msgs" />

<p:commandButton> action not working, So, I changed <p:button> type to <p:commandButton> to enable action property, so that I can navigate to dashboard.xhtml. I am trying to call  Primefaces CommandButton Ajax & Non-Ajax. Primefaces CommandButton has built-in ajax capabilities. By default the commandButton submits the enclosed form with ajax. It can be configured to submit form without ajax by setting ajax attribute to false. When ajax attribute is set to false, form is submitted in a regular full page refresh.

I think what Cagatay ment was:

Does not navigate the page:

<p:commandButton action="home.xhtml" value="Go Home"/>

Works (redirects the page):

<p:commandButton action="home.xhtml?faces-redirect=true" value="Go Home"/>

Works (redirects the page)

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

if .xhtml is your default postfix defined in web.xml:


More info can be found in the primefaces forum, for example in this discussion about navigation

I hope that helped a bit...

Primefaces - commandButton does not work, What's going on? What you get is correct behaviour. In PrimeFaces button with type="button" works as it does in basic HTML - it doesn't cause  Tag commandButton. Description: CommandButton is an extended version of standard JSF commandButton with ajax and skinning features. (must evaluate to javax.faces.component.UIComponent) An el expression referring to a server side UIComponent instance in a backing bean. (must evaluate to java.lang.String) Name of the client side widget.

You must use redirect if you are doing navigation and request is done with ajax.

Primefaces CommandButton, Primefaces CommandButton Attributes. Boolean value to specify the rendering of the component, when set to false component will not be rendered. A method expression or a String outcome that'd be processed when button is clicked. An actionlistener that'd be processed when button is clicked. CommandButton extends the standard h:commandButton with ajax, partial processing and skinning features. Documentation Ajax Submit Non-Ajax Submit With Icon Icon Only Disabled

I am having a similar problem.

I am using primefaces and primefaces mobile and the navigation fails in Firefox when using <p:commandButton> with ajax="false" and action="find.xhtml?faces-redirect=true".

The only way I could make it work also in Firefox was by using <h:commandButton>:

<h:commandButton value="#{msg.find}" process="find" 
                     action="find.xhtml?faces-redirect=true" />

jsf primeface command button doesn't call the action, jsf primeface command button doesn't call the action. New Member Posts: 3 Join Date: 2016-01-29 Recent Posts. Hi everyone, I'm new in liferay, primefaces,  PREMIUM TEMPLATES. Create awesome applications in no time using the premium templates and impress your users.

none of the above solution worked for me. You can still go for simple javascript

<p:commandButton onclick="window.location.href =home.xhtml"
                    style="height: 20px" type="button" title="title" icon="ui-icon-transferthick-e-w"/>

Primefaces CommandButton, It includes ajax, partial processing and skinning features. The <p:commandButton​> component is used to create button in JSF application. It is useful when we  Ajax Framework - Partial Submit. PartialSubmit reduces network traffic by only adding the partially processed components to the ajax request post. For big pages with many input components, partialSubmit is extremely useful as it leads to more lightweight requests. Compare the Post Data displayed by the logger for the difference.

Dialog: showing dialog on complete after update does not work the , 1) Environment PrimeFaces version: PF latest snapshot Does it work on the also I use update="dialog" property in the <p:commandButton> . PrimeFaces is a popular open source framework for JavaServer Faces featuring over 100 components, touch optimized mobilekit, client side validation, theme engine and more.

h:commandButton doesn't work on first click (JSF forum at Coderanch), When I click on the commandButton with the value "Hinzufügen" the action "​createAgendaEntry" won't be called. Only when I click the second  And unless the PrimeFaces commandButton is different than core JSF, action methods don't expect arguments, either. The data is updated by JSF, so there's no need to send in parameters, and an action is an action is an action. Only AJAX listener methods take Event parameters.

A Comprehensive Guide to JSF AJAX, The PrimeFaces command button is much more conservative: The action listener doesn't return a value, and it can't trigger navigation.

  • You want ajax="false" if you want to have a synchronous request with a navigation. As to the update parameter, see my comment in one of your previous questions which you didn't respond to yet.
  • Sry, just forgot about that -.-
  • As to the enctype="multipart/form-data" issue, for that you need to ensure that you've configured the PrimeFaces FileUploadFilter as per the instructions in their User Guide.
  • @BalusC: Ah, and now I know where that enctype came from - the file upload turned out to be unnecessary, but the attribute stayed around to mess up things... Thanks!
  • Your answer isffectively not different from others and in a way it is worse. Besides it not beimg a p:commandButton, which with the right attributes 'just works' it containsttributes that are not valid for an h:commandButton, mor that one of the other answers