Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So apparently the PrimeFaces <code>&lt;p:commandButton&gt;</code> and <code>&lt;p:commandLink&gt;</code> tags cannot be used interchangeably with <code>&lt;h:commandButton&gt;</code> and <code>&lt;h:commandLink&gt;</code>. I thought they supported the base behavior of the core JSF tags and then provided more PrimeFaces-specific stuff in addition to that. This is not the case. The PrimeFaces tags are different and only provide some of the behavior of the core JSF tags of the same name.</p> <p>So the solution to my problem is not really ideal. The PrimeFaces tags will not participate in an Ajax group using <code>&lt;f:ajax&gt;</code> to enclose a group of controls (as you can do with the core JSF tags). Also, the PrimeFaces command button and command link will not use a <code>&lt;f:ajax&gt;</code> or <code>&lt;p:ajax&gt;</code> child. There are two attributes that it will look for to enable Ajax behavior: 'update' and 'ajax'.</p> <p>Each tag must have an 'update' attribute that contains a space-separated list of Ajax render targets, just like the 'render' attribute of <code>&lt;f:ajax&gt;</code>. My PrimeFaces components are inside a Composite Component, so I have had to pass the list of render targets via a CC interface attribute.</p> <p>My command button inside the CC looks like this now:</p> <pre><code>&lt;p:commandButton id="pCommandButtonDeleteIconOnly" alt="#{bundle.delete}" image="ui-icon ui-icon-trash" ajax="true" update="#{cc.attrs.ajaxRenderTargets}" action="#{dataTableTestBean.actionDeleteDataTableRow(row)}" /&gt; </code></pre> <p>If I didn't want the command button to execute as an Ajax call, then apparently the 'ajax' attribute should be set to "false" and the 'update' attribute should not be provided at all. This <a href="https://stackoverflow.com/questions/4639205/primefaces-commandbutton-doesnt-navigate-or-update">SO question</a> helped point me in the right direction.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload