1

I'm trying to delete object from table, but when I click on 'delete' button then nothing happens and it should invoke method which will delete this particular object. MethodNotFoundException appears and I have no idea why. Here is a code:

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

method from ClientBean:

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

exception:

SEVERE: javax.el.MethodNotFoundException: Method not found: com.firanycrm.controller.ClientBean@14b77a2a.deleteClient(com.firanycrm.model.Client)
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
dante
  • 393
  • 1
  • 15
  • 31

1 Answers1

0

You do not need to put p:commandLink type to submit, and try to add process="@this" to your p:commandLink

<p:commandLink value="Delete" 
               update="table" 
               actionListener="#{clientBean.deleteClient(client)}" 
               process="@this" />
Bilal Dekar
  • 3,200
  • 4
  • 28
  • 53