dataTable选中的行未被检测到

时间:2012-09-12 11:08:47

标签: java datatable primefaces

我需要在我的dataTable中检索选定的行信息,但我收到错误,我跟着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 :" />&nbsp;  
    <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中,我创建了一个属性     私人集团选定的集团; 与吸气剂和二传手

错误:

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 个答案:

答案 0 :(得分:0)

首先你是否放置了表格标签?从:

开始
 <h:form id="form">
     //datatable
     //dialog
 </h:form>

你还有oncomplete是调用permessionDlg.show(),但是这不在你的页面中(或者你没有发布整个页面)并且你没有调用更新,所以你的弹出窗口永远不会去更新。

变化:

<p:commandButton value="See Permession " icon="ui-icon-search" oncomplete="permessionDlg.show()" />

p:commandButton value="See Permession " update=":form:display" icon="ui-icon-search" oncomplete="modifyGoupDlg.show()" />

如果这不能解决你的bean代码和整个页面的问题