2014-11-08 3 views
0

Это код XHTMLр: commandLink не вызывает ActionListener в р: DataTable

<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> 

и это боб

public void archiveInboxRecord(ActionEvent actionEvent){ 
    System.err.println("Record Title is " + this.selectedInbox.AppTitle); 
} 

ответ

0

после друзей помощи ..

правый код:

<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> 

и ключевым решением является процесс ввода данных «inboxdt»

1

Аргумент ActionEvent не требуют, чтобы послать при использовании ActionListener , Вместо этого вы должны использовать приведенный ниже код.

<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> 
0

Проверьте, если ваш 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 в из тега так:

<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> 
Смежные вопросы