0

Some of the command buttons' actionListener event of the xhtml page of my JSF app did not work until I added attribute process="@this" to the <p:commandButton.. tag. I am wondering why. I haven't seen this in any example. I am using a combination of JSF 2.2 & CDI, along with Primefaces 5.0 on JBoss 7.1 runtime. My beans are CDI @javax.inject.Named beans and scope is @javax.enterprise.context.RequestScoped..

stg
  • 2,757
  • 2
  • 28
  • 55
user2918640
  • 473
  • 1
  • 7
  • 25

2 Answers2

1

Here's an explanation of why you need to add attribute process="@this" to your <p:commandButton> : Why to add process="@this" explicitly to p:commandButton to get action invoked?

Community
  • 1
  • 1
Thrax
  • 1,926
  • 1
  • 17
  • 32
1

You just don't have to!

The default behaviour of PrimeFaces commandButton is process="@form" thus the whole form will be processed. If the actionListener does not get invoked when you change the behavior to process="form" explicitly, but gets invoked when you change it to process="@this" then this usually indicates some validation error or similar.

To test this just add an <p:messages autoUpdate="true"> into your page and you will see all error messages that may have occured.

Fix those confirmation and/or validation erros and you will see, that your action is beeing invoked, even if you do not add the process-Attribute explicitly.

stg
  • 2,757
  • 2
  • 28
  • 55
  • 1
    That helped, and pushed forth a pure newbie like me. – user2918640 Nov 07 '14 at 09:51
  • I tried another page with no validations this time. And there seems to be a problem. Please have a look: http://stackoverflow.com/questions/26821562/jsf-page-why-no-validations-yet-process-attribute-required – user2918640 Nov 08 '14 at 20:11