Search code examples
jsf-2managed-bean

Caused by: javax.el.MethodNotFoundException: Method not found


I couldn't see any thing.Here is my ManagedBean;

public class AralikKontrolEvent {

private String sayi;
private String mesaj="";

public String getMesaj() {
    return mesaj;
}

public void setMesaj(String mesaj) {
    this.mesaj = mesaj;
}

public String getSayi() {
    return sayi;
}

public void setSayi(String sayi) {
    this.sayi = sayi;
}

public void SayiKontrolEt(ActionEvent event){

    int a = Integer.parseInt(sayi);
    if(event.getComponent().getId().equals("gonder")){
        if(a>10){
            mesaj+="Sayı büyük";
        }else{
            mesaj+="Sayı küçük";
        }
    }

}

I called SayiKontrolEt method like below;

< h : commandButton value="Gönder" id="gonder" action="#{ake.SayiKontrolEt}"/>

But I get this error.I have looked lots of examples about jsf event.Everybody calls like I have called the method.What is the wrong which I haven't seen?


Solution

  • You have two options:

    1. Remove ActionEvent from the method
    2. Or change action to actionListener