Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Don't try to put a <code>&lt;p:ajax&gt;</code> inside the the <code>&lt;p:dataTable&gt;</code>. This is one of the PrimeFaces components where you declare the Ajax-related attributes right in the component itself.</p> <p>Here is an example from the PrimeFaces documentation:</p> <pre><code>&lt;p:dataTable var="car" value="#{carBean.cars}" selectionMode="single" selection="#{carBean.selectedCar}" onRowSelectUpdate="carListForm:dialogContent" rowSelectListener="#{carBean.onCarSelect}"&gt; ...columns &lt;/p:dataTable&gt; </code></pre> <p>See how the <code>rowSelectListener</code> attribute is declared right inside the <code>&lt;p:dataTable&gt;</code>?</p> <p>The error you were getting: <em>Parent not an instance of ClientBehaviorHolder</em></p> <p>This means that the parent tag cannot contain an Ajax tag. The example above is from the PrimeFaces 2.2 documentation, but I believe 3.0 is similar.</p> <p><strong>EDIT:</strong></p> <p>My mistake! I replied from home and didn't have access to my code that uses PrimeFaces 3.0. In PF 3.0 (unlike PF 2.2) you can embed the <code>&lt;p:ajax&gt;</code> element. Here is a code sample that works for me:</p> <pre><code>&lt;p:dataTable id="myDataTable" value="#{myBean.rowObjectList} var="rowObject" selection="#{myBean.selectedRowObject}" selectionMode="single"&gt; &lt;p:ajax event="rowSelect" listener="#{myBean.onRowSelect}" update="someElement" /&gt; &lt;p:ajax event="rowUnselect" listener="#{myBean.onRowUnselect}" update="someElement" /&gt; &lt;/p:dataTable&gt; </code></pre> <p>Here are my listener methods signatures:</p> <pre><code>public void onRowSelect(SelectEvent event) { // your code here... } public void onRowUnselect(UnselectEvent event) { // your code here... } </code></pre> <p>I don't know enough about your webapp to understand how your redirect is meant to work, but I will also give you a code sample that I'm using in my webapp after the user clicks a Logout button and I redirect them to a "you are logged out" page. This code is called from an action method.</p> <pre><code>FacesContext ctx = FacesContext.getCurrentInstance(); ExternalContext ectx = ctx.getExternalContext(); ServletContext sc = (ServletContext) ectx.getContext(); ectx.redirect("http://somedomain.org/somepage.html"); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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