Reputation: 615
I have the following code and I want to get the selected row.
@ManagedBean
@SessionScoped
public class ElementTableData {
private List<Element> elementList;
private DataModel<Element> model;
private HtmlDataTable htmlDataTable;
private Element element;
private List<Element> selectedElementList;
....
public HtmlDataTable getHtmlDataTable(){
return htmlDataTable;
}
public void setHtmlDataTable(HtmlDataTable aHtmlDataTable){
htmlDataTable = aHtmlDataTable;
}
....
}
When I am trying to make the binding
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<script type="text/javascript" src="js/global.js"></script>
</h:head>
<h:body>
<f:loadBundle
basename="messages"
var="labels" />
<h:form>
<h:dataTable binding="elementTableData.htmlDataTable" styleClass="dataTable" rowClasses="rowOdd,rowEven"
value="#{elementTableData.elementList}" var="element">
<!-- Table Title -->
<f:facet name="caption">#{labels.TableTitle}</f:facet>
I receive the following exception:
javax.faces.FacesException: javax.el.PropertyNotWritableException: /index.xhtml at line 20 and column 52 binding="elementTableData.htmlDataTable": Illegal Syntax for Set Operation
I have getter and setter for htmlDataTable and I don't understand why I am getting the exception.
Thank you very much!
Upvotes: 1
Views: 6464
Reputation: 81587
Set your binding as an EL expression:
<h:dataTable binding="#{elementTableData.htmlDataTable}" ...>
Upvotes: 1