I start with examples:
Example 1
<p:dataTable>
...
<p:column headerText="Actions" style="text-align:center; width:100px;">
<p:commandLink value="Delete" action="#{bean.delete}"
update="data">
<f:setPropertyActionListener target="#{bean.key}" value="#{item.key}" />
</p:commandLink>
</p:column>
...
</p:dataTable>
Example 2
<p:dataTable>
...
<p:column headerText="Actions" style="text-align:center; width:100px;">
<p:commandLink value="Delete" actionListener="#{bean.delete}"
update="data">
<f:setPropertyActionListener target="#{bean.key}" value="#{item.key}" />
</p:commandLink>
</p:column>
...
</p:dataTable>
In the first case (command link with action
), property bean.key
is set correctly but the table is not rendered again after the item is deleted.
In the second case (command link with actionListener
), property is not set and I get NullPointerException
. But I have another command link with actionListener
outside the table and it works fine and updates the table.
How can I make the first case to render the table after the item is deleted or somehow solve the problem?