How to clear all input fields in p:dataTable? - jsf-2

I am using JSF 2.0 with PrimeFaces. I have a <p:dataTable>. I have a <p:inputText> in a column. I can edit and save it. I have also a reset button, but it is not working.
<h:form id="f">
<f:facet name="head">Enteri Karbon Hesaplaması</f:facet>
<p:dataTable value="#{orderBean.orderList}" var="o" id="bir">
<p:column>
<f:facet name="header">Hayvan Adi</f:facet>
<h:outputText value="#{o.hayvanadi}"/>
</p:column>
<p:column>
<f:facet name="header">Karbon Salinimi Değeri</f:facet>
<h:outputText value="#{o.karbonsalinimi}"/>
</p:column>
<p:column>
<f:facet name="header">Adet</f:facet>
<p:inputText id="spinner" maxlength="12" value="#{o.adet}"/>
</p:column>
</p:dataTable>
<p:commandButton value="Kaydet" action="#{orderBean.saveAction()}" update="bir"/>
<p:commandButton value="Temizle" update="bir" process="#this" actionListener="#{orderBean.reset}"/>
</h:form>
Here is the relevant part of my backing bean:
#ManagedBean
#SessionScoped
public class OrderBean {
private static final ArrayList<Order> orderList =
new ArrayList<Order>(Arrays.asList(
new Order("Süt İneği", 99 , 0),
new Order("Diğer İnekler", 58, 0),
new Order("Koyun",5, 0),
new Order("Keçi",5, 0),
new Order("At ",18, 0),
new Order("Eşek ",10, 0)
)
);
public String saveAction() {
for (Order order : orderList){
order.setEditable(false);
}
return null;
}
public String editAction(Order order) {
order.setEditable(true);
return null;
}
public void reset() {
RequestContext.getCurrentInstance().reset("form:f");
}
// ...
}

Change the type of your command button to reset ie:
<p:commandButton type="reset" value="Temizle" update="bir" process="#this" actionListener="#{orderBean.reset}"/>
Also, since you are basically trying to make the datatable empty again you can just set orderList to an empty list in the reset function.

You can reset a form using <p:commandButton type="reset" or <p:commandButton update="#form". The latter is also used in p:inplace.
Edit: The reason your button isn't working is because the id referred in its update attribute isn't correct. It should be :formId:dataTableId. The #form is easier though.

Related

page can't get value from Bean

I have a table p:dataTable. When I select an item, it's refresh another p:dataTable with associed values.
It's works fine. But when I select an item in the second table, the page (xhtml) don't get the value from the bean.
In debug mode I see that the value is updated on bean, but acessing #{bean.value} is always null.
Where is the codes:
<h:form id="form">
<h:panelGrid columns="2">
<!-- FRIST TABLE -->
<p:dataTable id="alunos" var="aluno" emptyMessage="Nenhum aluno cadastrado" value="#{alunos.usuarios}" selectionMode="single" selection="#{alunos.usuarioSelecionado}" rowKey="#{aluno.id}">
<f:facet name="header">
Alunos
</f:facet>
<p:ajax event="rowSelect" listener="#{alunos.onRowSelect}" update=":form:disci" />
<p:column headerText="Nome" width="60%">
<h:outputText value="#{aluno.nome}" />
</p:column>
<p:column headerText="Curso">
<h:outputText value="Default" />
</p:column>
</p:dataTable>
<!-- FUNCTIONS FOR FRIST TABLE THAT ARE WORKING -->
<p:column rowspan="4">
<p:commandButton value="Adicionar" update="alunos" icon="ui-icon-plus" actionListener="#{alunos.addUser()}"/>
<p:commandButton value="Editar" icon="ui-icon-pencil" actionListener="#{alunos.editarUser()}"/>
<p:commandButton value="Remover" icon="ui-icon-close" actionListener="#{alunos.apagaUser()}"/>
</p:column>
</h:panelGrid>
<p:outputLabel for="disci" value="Disciplinas que o aluno cursa" />
<!-- SECOND TABLE - Updated when an iten is selected in frist table (working)-->
<p:dataTable id="disci" var="disciplina" emptyMessage="Selecione um aluno" value="#{alunos.disciplinas}" selectionMode="single" selection="#{alunos.disciplinaSelecionada}" rowKey="#{disciplina.id}">
<p:ajax event="rowSelect" listener="#{alunos.onRowSelectDisciplina}" oncomplete="PF('dDialog').show()"/>
<p:column headerText="Nome" width="80%">
<h:outputText value="#{disciplina.nome}" />
</p:column>
</p:dataTable>
<!-- Dialog to show informations - ALWAYS NULL -->
<p:dialog header="Info" widgetVar="dDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<p:outputPanel id="detail" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputText value="Id:" />
<h:outputText value="#{alunos.disciplinaSelecionada.id}" />
<h:outputText value="Nome" />
<h:outputText value="#{alunos.disciplinaSelecionada.nome}" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
And the Bean:
#ManagedBean(name = "alunos")
#ViewScoped
public class Alunos extends NovoUsuario {
private Disciplina disciplinaSelecionada;
public Alunos() {
super(TiposUsuario.ALUNO);
}
//Method called when an iten is selected in SECOND TABLE
//In debug, the Object Disciplina is correct, as selected in table.
public void onRowSelectDisciplina(SelectEvent event) {
this.disciplinaSelecionada = (Disciplina) event.getObject();
}
//getters and setters
}
extended class:
public class NovoUsuario implements Serializable{
private List<Usuario> usuarios;
protected Usuario usuarioSelecionado;
TiposUsuario tipo;
private String nome;
private String senha;
protected List<Disciplina> disciplinas;
//Constructor
public NovoUsuario(TiposUsuario tipo) {
this.tipo = tipo;
}
//Initialize FRIST TABLE
#PostConstruct
public void init() {
UsuarioCRUD usuarioCRUD = new UsuarioCRUD();
this.usuarios = usuarioCRUD.listarTipoUsuario(tipo);
}
//Method used in FRIST TABLE
public void onRowSelect(SelectEvent event) {
disciplinas = getDisciplinaUsuario();
}
//Method that get data to SECOND table when a row is selectd in frist
public List<Disciplina> getDisciplinaUsuario() {
DisciplinaCRUD dcrud = new DisciplinaCRUD();
if (usuarioSelecionado != null) {
return dcrud.listaDisciplinasUsuario(usuarioSelecionado);
}
return null;
}
public void salvaUsuario() {
/* code to create*/
}
public void editarUser(){
/* code to update*/
}
public void apagaUser(){
/* code to delete*/
}
//GETTERS AND SETTERS
}
image: http://i.stack.imgur.com/Qbs0T.png
repository: https://bitbucket.org/VagnerGon/novo-academico
I'd say you just need to update the dialogs content from the p:ajax in the second table - just as you update the second datatable, when you select in the first.
So add id="dialog" to the dialog, and make the p:ajax in the second table
<p:ajax event="rowSelect" listener="#{alunos.onRowSelectDisciplina}" update=":form:dialog" oncomplete="PF('dDialog').show()" />
Or omit the new id and just do update=":form:detail".

Primefaces datatable hasn't been refreshed after applying the filter

I have some code is similar to the following showcase:
http://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml
The filter is applied correctly in the backing bean, although the datatable hasn't been refreshed with the new filtered rows. It remains as it is before applying the filter. Is there something missing or wrong in this showcase?
<h:form>
<p:dataTable var="serviceEntity" value="#{serviceSearchMB.allServices}" widgetVar="serviceSearchTable"
emptyMessage="No services found with given criteria" filteredValue="#{serviceSearchMB.filteredServices}">
<f:facet name="header">
<h:outputText value="Search all fields:" />
<p:inputText id="globalFilter" onkeyup="PF('serviceSearchTable').filter();"
style="width:150px" placeholder="Enter keyword" />
</f:facet>
<p:column filterBy="#{serviceEntity.serviceName}" headerText="Service Name" filterMatchMode="contains" >
<h:outputText value="#{serviceEntity.serviceName}" />
</p:column>
...
Backing Bean:
#ManagedBean(name="serviceSearchMB")
#RequestScoped
public class ServiceSearchManagedBean implements Serializable {
private List<ServiceSearchEntity> filteredServices;
public List<ServiceSearchEntity> getFilteredServices() {
return filteredServices;
}
public void setFilteredServices(List<ServiceSearchEntity> filteredServices) {
this.filteredServices = filteredServices; // Already set the filtered list correctly.
}
public List<ServiceSearchEntity> getAllServices() {
//already returns all services.
}
...

Enable/Disable <p:commandButton> in footer of <p:dataTable> based on change of <p:column selection="multiple">

I have a datatable where I am showing List of Employees. At the end of the datatable I have a commandbutton. Now if user selects any checkbox inside the datatable, I want my commandbutton to be enabled. Initially the command button is disabled.
Below is my index.xhtml page
<p:dataTable value="#{userPreferencesBean.studentDataModel}"
var="studentDetails" emptyMessage="No Student found."
selection="#{userPreferencesBean.selectedStudents}">
<f:facet name="header">
List of Students
</f:facet>
<p:ajax event="rowSelect" update="submit" listener="#{userPreferencesBean.onRowSelect}"/>
<p:ajax event="rowUnselect" update="submit" listener="#{userPreferencesBean.onRowSelect}"/>
<p:column selectionMode="multiple" style="width:2%" />
//All the columns
<f:facet name="footer">
<p:commandButton id="submit" value="Save Preferences"
icon="ui-icon-disk" style="float:right;"
action="#{userPreferencesBean.savePreferredInterfaces}"
update=":#{p:component('selectedInterfaceDetails')}"
disabled="#{not userPreferencesBean.hasPreferenceChanged eq false}"/>
</f:facet>
</p:dataTable>
Below is my backing bean:
#ManagedBean
#SessionScoped
public class UserPreferencesBean implements Serializable {
private boolean hasPreferenceChanged = false;
public void onRowSelect(SelectEvent event) {
this.setHasPreferenceChanged(true);
}
public boolean isHasPreferenceChanged() {
return hasPreferenceChanged;
}
public void setHasPreferenceChanged(boolean hasPreferenceChanged) {
this.hasPreferenceChanged = hasPreferenceChanged;
}
What I am expecting is that once I select a row, my submit button should be enabled. But it is not happening. Could you please help me to understand where I am doing wrong? Thanks.
With regards,
Sudipta Deb
Try put your table into form.
Also you can make it more convient:
<p:commandButton id="submit" ... disabled="#{userPreferencesBean.selectedStudents==null}"/>

Custom scope of a ManagedBean in JSF2.0 with PrimeFaces 3.5

Following is my requirement-
Here I have a p:panelGrid which can add & delete the row of table. The grid contains some p:inputText and various other PrimeFaces components along with a p:fileUpload component in each row. The component p:fileUpload is set with mode="advanced" auto="true" attributes, which automatically uploads the file and hide itself after completing the successful upload.
The whole p:panelGrid is in #ViewScoped, hence working fine. I kept p:fileUpload component in #RequestScoped since for each upload request it has to upload the file but after adding new row, the previous state is not persisted anymore. so the p:fileUpload is starting visible in previous rows also. That's what I don't want. Do I need to write any custom scope for it?
Below is the view-|
<h:form>
<p:panel id="agentForm" header="#{msg.AGENTS_INFORMATION}"
style="overflow:auto; margin-bottom: 2px">
<div align="center" style="margin-top: 20px; margin-bottom: 2px">
<ui:repeat value="#{agent.scenarioList}" var="c">
<p:panelGrid>
<p:row>
<p:column>
<p:inputText id="ipaddress" value="#{c.machineIpAddress}"
style="width:90%">
<p:watermark for="ipaddress" value="#{msg.MACHINE_IP_ADDRESS}" />
</p:inputText>
</p:column>
<p:column>
<p:inputText id="username" value="#{c.machineUsername}"
style="width:90%">
<p:watermark for="username" value="#{msg.MACHINE_USERNAME}" />
</p:inputText>
</p:column>
<p:column>
<p:password id="passwd" value="#{c.machinePassword}">
<p:watermark for="passwd" value="#{msg.MACHINE_PASSWORD}" />
</p:password>
</p:column>
<p:column id="fileUpload">
<p:fileUpload rendered="#{!fileUploadController.hidden}"
label="Upload Script" style="font-size: 100% !important;"
showButtons="false"
fileUploadListener="#{fileUploadController.upload}"
mode="advanced" auto="true" sizeLimit="100000"
allowTypes="/(\.|\/)(py|txt)$/"
update="fileUpload, outPanel, :message" />
<p:outputPanel id="outPanel">
<!-- Below outputLabel will be linked to uploaded file, so that User can see the file -->
<p:outputLabel style="cursor: pointer" value="View uploded Script"
label="View Script" rendered="#{fileUploadController.hidden}" />
</p:outputPanel>
</p:column>
<p:column>
<p:inputText id="testname" value="#{c.testName}"
style="width:90%">
<p:watermark for="testname" value="#{msg.TEST_NAME}" />
</p:inputText>
</p:column>
<p:column>
<p:spinner id="threads" value="#{c.threads}" min="1" max="500"
size="8">
<p:tooltip for="threads" value="#{msg.TEST_NAME}"
showEffect="slide" hideEffect="slide" />
</p:spinner>
</p:column>
<p:column>
<p:selectBooleanCheckbox id="chkSelected" value="#{c.selected}">
<p:tooltip for="chkSelected" value="#{msg.CHECKBOX}"
showEffect="slide" hideEffect="slide" />
</p:selectBooleanCheckbox>
</p:column>
</p:row>
</p:panelGrid>
</ui:repeat>
<p:toolbar style="margin-top: 10px;">
<p:toolbarGroup align="right">
<p:commandButton value="#{msg.ADD_IT}"
update=":message, agentForm"
actionListener="#{agent.addComponent()}" />
<p:commandButton value="#{msg.DELETE_IT}"
update=":message, agentForm"
actionListener="#{agent.deleteComponent()}" />
</p:toolbarGroup>
</p:toolbar>
</div>
</p:panel>
</h:form>
My managed bean which is in #ViewScoped look like this-
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.ravij.performance.model.Scenario;
#ManagedBean(name = "agent")
#ViewScoped
public class AgentInfo implements Serializable {
private static final long serialVersionUID = 1L;
List<Scenario> scenarioList;
#PostConstruct
public void initBean() {
this.scenarioList = new ArrayList<Scenario>();
this.scenarioList.add(new Scenario());
}
public void addComponent() {
if (this.scenarioList != null) {
this.scenarioList.add(new Scenario());
} else {
this.initBean();
}
}
public void deleteComponent() {
List<Scenario> itemsToDelete = new ArrayList<Scenario>();
if (this.scenarioList != null) {
for (Scenario b : this.scenarioList) {
if (b.isSelected()) {
itemsToDelete.add(b);
}
}
this.scenarioList.removeAll(itemsToDelete);
}
}
public List<Scenario> getScenarioList() {
return scenarioList;
}
public void setScenarioList(List<Scenario> scenarioList) {
this.scenarioList = scenarioList;
}
}
The Scenario object contains all the information of a row. Below is the code-
package org.ravij.performance.model;
import java.io.Serializable;
public class Scenario implements Serializable {
private String machineIpAddress;
private String machineUsername;
private String machinePassword;
private String uploadedFilePath;
private String testName;
private int threads = 1;
private boolean selected = false;
//Below are the getters and setter w.r.t all the above variables
//I am not putting it, to make the code short
}
The managed bean FileUploadController is in #RequestScoped
You should simply keep your hidden attribute with the other values in your #ViewScoped bean. Your current code has a single hidden attribute shared with all your <p:fileUpload components which is probably not what you want.
The behavior looks good because you are only updating the current fileUpload but according to your code all the others <p:fileUpload component are supposed to be hidden.
You should also put your <h:form into your <ui:repeat so that you can know the current line which is concerned by the file being uploaded by putting something like an index (which you can get from the <ui:repeat using varStatus attribute) or any other identifier to match the current line in an hidden input.
From #{fileUploadController.upload} the easiest manner to get the hidden parameter is to get the response from FacesContext as explained here : How to get parametrs to BackingBean from jsf page in <ui:repeat>
UPDATE
It was a bit harder than expected, the problem is that <p:fileUpload will send everything in the enclosing form (didn't try to play with process attribute) and thus it will be hard to know what row is concerned by the file upload.
Also I didn't knew that you couldn't put <h:form in your <ui:repeat but the behavior of your delete button is blocking as it expects to get everything in one form.
I made a working POC using dialog to put the fileupload outside, here is how :
The trivial Scenario.java :
public class Scenario implements Serializable {
private String machineIpAddress;
private String machineUsername;
private String machinePassword;
private String uploadedFilePath;
private String testName;
private int threads = 1;
private boolean selected = false;
private boolean hidden = false; // This is new
// + Getters/Setters
}
A few changes in the AgentInfo.java :
#ManagedBean(name = "agent")
#ViewScoped
public class AgentInfo implements Serializable {
private List<Scenario> scenarioList;
private Scenario currentScenario; // This is new
// I removed the #PostConstruct which I rarely use
public void addComponent() {
if (this.scenarioList != null) {
this.scenarioList.add(new Scenario());
}
}
public void deleteComponent() {
if (this.scenarioList == null) {
return;
}
List<Scenario> itemsToDelete = new ArrayList<Scenario>();
for (Scenario scenario : this.scenarioList) {
if (scenario.isSelected()) {
itemsToDelete.add(scenario);
}
}
this.scenarioList.removeAll(itemsToDelete);
}
// This is new, it must be called before opening the upload dialog
// in order to keep a pointer on the current scenario you are working on
public void prepareUpload(Scenario scenario) {
this.currentScenario = scenario;
}
// I put the upload method here
public void upload(FileUploadEvent event) {
// Do what you need to do here
this.currentScenario.setHidden(true);
RequestContext.getCurrentInstance().execute("uploadDialogWidget.hide()");
}
public List<Scenario> getScenarioList() {
if (this.scenarioList == null) {
this.scenarioList = new ArrayList<Scenario>();
this.scenarioList.add(new Scenario());
}
return scenarioList;
}
public void setScenarioList(List<Scenario> scenarioList) {
this.scenarioList = scenarioList;
}
public Scenario getCurrentScenario() {
return currentScenario;
}
public void setCurrentScenario(Scenario currentScenario) {
this.currentScenario = currentScenario;
}
}
The most changes are in the view, I put a <h:commandButton to open the dialog in the form. I also added the dialog, and added the redisplay attribute for your password fields (which is necessary to have if you want to keep the value after form submission).
Note that I removed references to a component with message id which was not gave, don't forget to reintroduce it.
the .xhtml :
<h:form id="agentForm">
<p:panel header="#{msg.AGENTS_INFORMATION}"
style="overflow:auto; margin-bottom: 2px">
<div align="center" style="margin-top: 20px; margin-bottom: 2px">
<ui:repeat value="#{agent.scenarioList}" var="c">
<p:panelGrid>
<p:row>
<p:column>
<p:inputText id="ipaddress" value="#{c.machineIpAddress}"
style="width:90%">
<p:watermark for="ipaddress" value="#{msg.MACHINE_IP_ADDRESS}" />
</p:inputText>
</p:column>
<p:column>
<p:inputText id="username" value="#{c.machineUsername}"
style="width:90%">
<p:watermark for="username" value="#{msg.MACHINE_USERNAME}" />
</p:inputText>
</p:column>
<p:column>
<p:password id="passwd" value="#{c.machinePassword}" redisplay="true">
<p:watermark for="passwd" value="#{msg.MACHINE_PASSWORD}" />
</p:password>
</p:column>
<p:column id="fileUpload">
<p:commandButton icon="ui-icon-arrowthick-1-n" value="Upload"
actionListener="#{agent.prepareUpload(c)}"
update=":uploadDialog"
oncomplete="uploadDialogWidget.show()"
rendered="#{!c.hidden}" />
<p:outputPanel id="outPanel">
<!-- Below outputLabel will be linked to uploaded file, so that User can see the file -->
<p:outputLabel style="cursor: pointer" value="View uploded Script"
rendered="#{c.hidden}" />
</p:outputPanel>
</p:column>
<p:column>
<p:inputText id="testname" value="#{c.testName}"
style="width:90%">
<p:watermark for="testname" value="#{msg.TEST_NAME}" />
</p:inputText>
</p:column>
<p:column>
<p:spinner id="threads" value="#{c.threads}" min="1" max="500"
size="8">
<p:tooltip for="threads" value="#{msg.TEST_NAME}"
showEffect="slide" hideEffect="slide" />
</p:spinner>
</p:column>
<p:column>
<p:selectBooleanCheckbox id="chkSelected" value="#{c.selected}">
<p:tooltip for="chkSelected" value="#{msg.CHECKBOX}"
showEffect="slide" hideEffect="slide" />
</p:selectBooleanCheckbox>
</p:column>
</p:row>
</p:panelGrid>
</ui:repeat>
<p:toolbar style="margin-top: 10px;">
<p:toolbarGroup align="right">
<p:commandButton value="#{msg.ADD_IT}" update="agentForm"
actionListener="#{agent.addComponent()}" />
<p:commandButton value="#{msg.DELETE_IT}" update="agentForm"
actionListener="#{agent.deleteComponent()}" />
</p:toolbarGroup>
</p:toolbar>
</div>
</p:panel>
</h:form>
<p:dialog id="uploadDialog" widgetVar="uploadDialogWidget" header="File upload">
<h:form rendered="#{!empty agent.currentScenario}">
<p:fileUpload
label="Upload Script" style="font-size: 100% !important;"
showButtons="false"
fileUploadListener="#{agent.upload}"
mode="advanced" auto="true" sizeLimit="100000"
allowTypes="/(\.|\/)(py|txt)$/"
update=":agentForm">
</p:fileUpload>
<p:commandButton value="Cancel" onclick="uploadDialogWidget.hide();" onstart="return false;" />
</h:form>
</p:dialog>
You should consider to move from <p:panelGrid to a <p:dataTable which has a built in mechanism to work with row selection.

<p:commandButton> does not invoke method when <p:column selectionMode="multiple"> is added

I have a <p:dialog> with a <p:dataTable> and a <p:commandButton>.
When I add <p:columm selectionMode="multiple"> to the table, then the button doesn't invoke the action listener method. Without that column, it works fine.
How is this caused and how can I solve it?
Here is my view:
<p:dialog id="CategoriasShowPadre" header="#{msgs['Categorias.BusquedaDeCategorias']}" widgetVar="CategoriasShowPadre" modal="true">
<p:dataTable id="DTBusquedaCategoriasPadre" widgetVar="posiblesTablaP" var="BcatP" value="#{agregarCategorias.categoriasPosibles}"
emptyMessage="#{msgs['Categoria.SinRegistros']}" rowKey="#{BcatP.nombre}" selection="#{agregarCategorias.categoriasPosiblesSelecionadas}">
<p:column selectionMode="multiple" style="width:18px" />
<p:column id="nombreCol" filterBy="#{BcatP.nombre}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="#{msgs['Categoria.ColunmnaNombre']}" />
</f:facet>
<h:outputText value="#{BcatP.nombre}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msgs['Categoria.ColunmnaDescripcion']}" />
</f:facet>
<h:outputText value="#{BcatP.descripcion}" />
</p:column>
</p:dataTable>
<p:commandButton id="AnadiraPadre" value="#{msgs['Categoria.Boton.AgregarCategorias']}"
immediate="true" actionListener="#{agregarCategorias.selecionadosElementosPadres()}"
onclick="CategoriasShowPadre.hide();" />
</p:dialog>
Here is the backing bean:
#ManagedBean
#RequestScoped
public class AgregarCategorias {
private List<Categorias> CategoriasPosibles;
private List<Categorias> CategoriasPosiblesSelecionadas;
#PostConstruct
private void MiPostConstructor() {
this.CategoriasPosibles = // ...
}
public List<Categorias> getCategoriasPosiblesSelecionadas() {
return CategoriasPosiblesSelecionadas;
}
public void setCategoriasPosiblesSelecionadas(List<Categorias> CategoriasPosiblesSelecionadas) {
this.CategoriasPosiblesSelecionadas = CategoriasPosiblesSelecionadas;
}
public List<Categorias> getCategoriasPosibles() {
return CategoriasPosibles;
}
public void setCategoriasPosibles(List<Categorias> CategoriasPosibles) {
this.CategoriasPosibles = CategoriasPosibles;
}
public void selecionadosElementosPadres(ActionEvent evento) {
// my method code
}
}
The 'selection' attribute of the datatable should reference an array of the domain object.
So change private List<Categoria> CategoriasPosiblesSelecionadas for private Categoria[] CategoriasPosiblesSelecionadas

Resources