i need to retrieve the selected row info in my dataTable but i'm getting error , i followed primefaces official docs but i can't understand where the problem is here's my code :
我需要在我的dataTable中检索选定的行信息,但我得到错误,我跟着primefaces官方文档但我无法理解问题出在哪里这是我的代码:
Xhtml page:
<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>
in my managed bean ProjectAdminisrationMB i created an attribute private Group selectedGroup; with getter and setter
在我的托管bean ProjectAdminisrationMB中我创建了一个属性private Group selectedGroup;与吸气剂和二传手
Error :
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)
1 个解决方案
#1
0
Well first did you placed form tags? start with:
那么你首先放置了表格标签吗?从...开始:
<h:form id="form">
//datatable
//dialog
</h:form>
Also you have oncomplete on is calling permessionDlg.show() but that isn't in your page (or you didn't posted the whole page) and you're not calling an update so your popup is never going to bu updated.
你还有oncomplete on调用permessionDlg.show(),但这不在你的页面中(或者你没有发布整个页面)并且你没有调用更新,所以你的弹出窗口永远不会更新。
change:
<p:commandButton value="See Permession " icon="ui-icon-search" oncomplete="permessionDlg.show()" />
to
p:commandButton value="See Permession " update=":form:display" icon="ui-icon-search" oncomplete="modifyGoupDlg.show()" />
If this not solves the problem post your bean code and your complete page
如果这不能解决你的bean代码和整个页面的问题
#1
0
Well first did you placed form tags? start with:
那么你首先放置了表格标签吗?从...开始:
<h:form id="form">
//datatable
//dialog
</h:form>
Also you have oncomplete on is calling permessionDlg.show() but that isn't in your page (or you didn't posted the whole page) and you're not calling an update so your popup is never going to bu updated.
你还有oncomplete on调用permessionDlg.show(),但这不在你的页面中(或者你没有发布整个页面)并且你没有调用更新,所以你的弹出窗口永远不会更新。
change:
<p:commandButton value="See Permession " icon="ui-icon-search" oncomplete="permessionDlg.show()" />
to
p:commandButton value="See Permession " update=":form:display" icon="ui-icon-search" oncomplete="modifyGoupDlg.show()" />
If this not solves the problem post your bean code and your complete page
如果这不能解决你的bean代码和整个页面的问题