Jsf p:commandLink不';t调用p:dataTable中的actionlistener

Jsf p:commandLink不';t调用p:dataTable中的actionlistener,jsf,primefaces,Jsf,Primefaces,这是XHTML代码 <p:commandLink style="width: 10px;height: 10px;" actionListener="#{InboxBean.archiveInboxRecord(actionEvent)}"> <img src="../resources/images/arch.png" /> <f:setPropertyActionListener value="#{inboxitem}

这是XHTML代码

<p:commandLink style="width: 10px;height: 10px;" 
               actionListener="#{InboxBean.archiveInboxRecord(actionEvent)}">
   <img src="../resources/images/arch.png" />
   <f:setPropertyActionListener value="#{inboxitem}" 
                                target="#{InboxBean.selectedInbox}"/>
</p:commandLink>

使用actionListener时,不需要发送参数actionEvent。您应该使用下面的代码

<p:commandLink style="width: 10px;height: 10px;" 
               actionListener="#{InboxBean.archiveInboxRecord}" >
   <img src="../resources/images/arch.png" />
   <f:setPropertyActionListener value="#{inboxitem}" 
                                target="#{InboxBean.selectedInbox}" />
</p:commandLink>

检查datatable是否位于表单标记中 就像这样:

<h:form id="form">
<p:datatable var="student" value="#{studentbean.listStd}">
<p:column headerText="column 1">Something here ..</p:column>
<p:column headerText="Action">
<p:commandLink style="width: 10px;height: 10px;" 
               actionListener="#{InboxBean.archiveInboxRecord}" >
   <img src="../resources/images/arch.png" />
   <f:setPropertyActionListener value="#{inboxitem}" 
                                target="#{InboxBean.selectedInbox}" />
</p:commandLink>
</p:column>
</p:datatable>
</h:form>

这里有些东西。。
或者尝试将commandLink放入from标记中,如下所示:

<h:form id="formLink">
<p:commandLink style="width: 10px;height: 10px;" 
               actionListener="#{InboxBean.archiveInboxRecord}" >
   <img src="../resources/images/arch.png" />
   <f:setPropertyActionListener value="#{inboxitem}" 
                                target="#{InboxBean.selectedInbox}" />
</p:commandLink>
</h:form>

在朋友帮助之后

正确的代码是

<p:commandLink  style="width: 10px;height: 10px;" 
                                                   process="inboxdt"  
                                                   actionListener ="#{InboxBean.archiveInboxRecord(actionEvent)}" >

                                      <img src="../resources/images/arch.png" />
                                        <f:setPropertyActionListener value="#{inboxitem}" target="#{InboxBean.selectedInbox}" />
                                    </p:commandLink>

关键的解决方案是处理数据表Id“inboxdt”

<p:commandLink  style="width: 10px;height: 10px;" 
                                                   process="inboxdt"  
                                                   actionListener ="#{InboxBean.archiveInboxRecord(actionEvent)}" >

                                      <img src="../resources/images/arch.png" />
                                        <f:setPropertyActionListener value="#{inboxitem}" target="#{InboxBean.selectedInbox}" />
                                    </p:commandLink>