p:commandLink不会对方法做出反应 - MethodNotFoundException

时间:2016-09-10 21:43:36

标签: jsf primefaces el methodnotfound

我试图从表格中删除对象,但是当我点击“删除”时,会删除'按钮然后没有任何反应,它应该调用将删除此特定对象的方法。出现MethodNotFoundException,我不知道为什么。这是一个代码:

.xhtml:                      

                <p:column headerText="Imię">
                    <h:outputText value="#{client.firstName}" />
                </p:column>
                <p:column headerText="Nazwisko">
                    <h:outputText value="#{client.lastName}" />
                </p:column>

                <p:column>                  
                    <p:commandLink type="submit" value="Usuń"
                    style="font-size: 11px"
                        update="searcher:table:clientsTable" 
                        ajax="true"
                        actionListener="#{clientBean.deleteClient(client)}"
                        styleClass="btn btn-danger resized-font delete-btn"
                        icon="glyphicon glyphicon-trash">
                        <span class="glyphicon glyphicon-trash"></span>                                     
                    </p:commandLink>


                    <a href="klienci/#{client.ID}"
                    style="font-size: 11px"
                        class="btn btn-primary resized-font"><span
                        class="glyphicon glyphicon-book"></span> Informacje</a>

                </p:column>
            </p:dataTable>
        </h:form>
来自ClientBean的

方法:

public void deleteClient(Client client){
    clientDao.delete(client);
}

异常:

SEVERE: javax.el.MethodNotFoundException: Method not found: com.firanycrm.controller.ClientBean@14b77a2a.deleteClient(com.firanycrm.model.Client)

1 个答案:

答案 0 :(得分:0)

您无需将submit类型添加到process="@this",并尝试将p:commandLink添加到<p:commandLink value="Delete" update="table" actionListener="#{clientBean.deleteClient(client)}" process="@this" />

public class MyService extends Service{ 

@Override
public IBinder onBind(Intent intent) {
    return null;
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {

IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Const.LOCATION_LOGGER_ACTION);
intentFilter.addAction(Intent.ACTION_NEW_OUTGOING_CALL);

registerReceiver(new BroadcastReceivers(), intentFilter);
return START_STICKY;

}

}