我有以下代码,我想获取选定的行。
@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;
}
....
}
当我尝试进行绑定时
<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>
我收到以下异常:
javax.faces.FacesException: javax.el.PropertyNotWritableException: /index.xhtml at line 20 and column 52 binding="elementTableData.htmlDataTable": Illegal Syntax for Set Operation
我有 htmlDataTable 的 getter 和 setter,但我不明白为什么会出现异常。
非常感谢!