我需要在我的数据表中检索选定的行信息,但出现错误,我遵循了 primefaces 官方文档,但我不明白问题出在哪里,这是我的代码:
Xhtml页面:
<p:dataTable id="groups" var="group" value="#{projectAdminisrationMB.groupsList}" rowKey="#{group.name}" selection="#{projectAdminisrationMB.selectedGroup}" selectionMode="single">
<f:facet name="header">
</f:facet>
<p:column id="column2">
<f:facet name="header">
<h:outputText value="Group Name"></h:outputText>
</f:facet>
<p:graphicImage value="/images/group/#{group.name}.gif" />
<h:outputText value="#{group.name}"></h:outputText>
</p:column>
<p:column id="column3">
<f:facet name="header">
<h:outputText id="text3" value=" Group Description "></h:outputText>
</f:facet>
<h:outputText value="#{group.description}"></h:outputText>
</p:column>
<f:facet name="footer">
<p:commandButton value="See Permession " icon="ui-icon-search" oncomplete="permessionDlg.show()" />
</f:facet>
</p:dataTable>
<p:dialog header="Modify Group" widgetVar="modifyGoupDlg" width="750" showEffect="explode" hideEffect="explode">
<br />
<br />
<h:outputText value="New Group :" />
<p:inputText id="updatedGroupName" value="#{projectAdminisrationMB.selectedGroup.name}" required="true"></p:inputText>
<br />
<br />
<h:outputText value="Group Description :" />
<br />
<br />
<p:editor id="updatedGroupDescription" value="#{projectAdminisrationMB.selectedGroup.description}" width="600" />
<br />
<br />
<p:commandButton id="ValidateModif" value="Validate" actionListener="#{projectAdminisrationMB.modifyGoup}" onclick="modifyGoupDlg.hide()"></p:commandButton>
<p:commandButton id="CancelModif" value=" Cancel " onclick="modifyGoupDlg.hide()"></p:commandButton>
</p:dialog>
在我的托管 bean ProjectAdminisrationMB 中,我创建了一个属性私有组 selectedGroup;使用 getter 和 setter
错误 :
Avertissement: /manage_Project_Groups.xhtml @96,133 value="#{projectAdminisrationMB.selectedGroup.name}": Target Unreachable, 'selectedGroup' returned null
javax.el.PropertyNotFoundException: /manage_Project_Groups.xhtml @96,133 value="#{projectAdminisrationMB.selectedGroup.name}": Target Unreachable, 'selectedGroup' returned null
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:97)
at org.primefaces.renderkit.InputRenderer.findImplicitConverter(InputRenderer.java:170)