I have a Session Managed Bean where I have a list that I show in datatable and when I click in button I change the list in the managed bean but the table didnt change in the JSF page :
<p:commandButton id="someId" value="Button" action="#{gestionduplanning.exec2()}">
<f:ajax render="koka"/>
</p:commandButton>
<p:dataTable id="koka" var="op" value="#{gestionduplanning.listop}" style="width: 700px;float: left;">
<p:column headerText ="operateur" style="width:50px;" >
<h:outputText value="#{op.operateur.matricule}"/>
</p:column>
</p:dataTable>
How can I update the table in JSF and I need to keep my managed bean as session bean?
Remove <f:ajax render="koka"/>
and add update="koka"
to your <p:commandButton
<p:commandButton update="koka" id="someId" value="Button" action="#{gestionduplanning.exec2()}"/>
Also you better don't nest f:ajax
with inside Primefaces components and vice versa...
f:ajax
is meant to use with native JSF components
p:ajax
is meant to use with PrimeFaces components
It is fine to have both , Primefaces components and JSF native components in one page, just make sure to use p:ajax
in Primefaces components and f:ajax
in JSF native components