Target Unreachable, identifier Hatası
Merhaba arkadaşlar bugün benimde zaman zaman aldığım hatanın çözümünü yazmak istedim.Aşağıda öncelikli olarak kodları paylaşmak istiyorum:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <h:head></h:head> <body> <h:form> <h:panelGrid columns="2"> <f:facet name="header">Kullanıcı Kayıt</f:facet> <h:outputText value="İsim Girin :" /> <h:inputText value="#{işlemler.pojo.isim}" /> <h:outputText value="Soyisim Girin :" /> <h:inputText value="#{işlemler.pojo.soyisim}" /> <h:outputText value="E-Mail Girin :" /> <h:inputText value="#{işlemler.pojo.mail}" /> <h:outputText value="Şifre Girin :" /> <h:inputText value="#{işlemler.pojo.parola}"/> <h:column></h:column> <h:commandButton action="#{işlemler.kaydet()}" value="Kaydet"/> </h:panelGrid> </h:form> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
package com.furkan; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped public class Pojolar { private static final long serialVersionUID = 1L; private byte gorunur =1; private String isim=""; private String mail=""; private String parola=""; private String soyisim=""; public byte getGorunur() { return this.gorunur; } public void setGorunur(byte gorunur) { this.gorunur = gorunur; } public String getIsim() { return this.isim; } public void setIsim(String isim) { this.isim = isim; } public String getMail() { return this.mail; } public void setMail(String mail) { this.mail = mail; } public String getParola() { return this.parola; } public void setParola(String parola) { this.parola = parola; } public String getSoyisim() { return this.soyisim; } public void setSoyisim(String soyisim) { this.soyisim = soyisim; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
package com.furkan; import java.io.Serializable; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped public class Islemler implements Serializable { private static final long serialVersionUID = 1L; Pojolar pojo=new Pojolar(); Veritabani veritabani=new Veritabani(); Genel genel=new Genel(); public void kaydet() { try { System.out.println("Girdi"); genel.setIsim(pojo.getIsim()); genel.setSoyisim(pojo.getSoyisim()); genel.setMail(pojo.getMail()); genel.setParola(pojo.getParola()); veritabani.transaction.begin(); veritabani.manager.persist(genel); veritabani.transaction.commit(); } catch (Exception e) { System.out.println("Kayıtta Hata Var :"+e.toString()); } } public Pojolar getPojo() { return pojo; } public void setPojo(Pojolar pojo) { this.pojo = pojo; } } |
Gördüğünüz üzere yazılan kodlar bu şekilde. Normalde yazılan kodlarda hata olmamasına karşın tahminimce Eclipse IDE tarafından bize javax.el.PropertyNotFoundException: Target Unreachable, identifier ‘ıslemler’ resolved to null hatası fırlatılıyor.Bu hatayı aldıktan sonra uzun bir araştırma yaptım ve bu hata yukarıdada bahsettiğim gibi Eclipse tarafından kaynaklanıyor. Yukarıdaki kodları Netbeans IDE’de yazınca kodlar doğru bir şekilde çalışıyor.Şimdi gelelim hatanın çözümüne;
Hatanın çözümü son derece çok basit managed bean olarak kullandığımız sınıfta notasyonun yanına @ManagedBean(name = “deneme”)ekleyip index.xhtml de islemler yerine deneme yazdığımızda kodlar çalışıyor.Şunu demekte fayda var bu hata şans eseri alınıyor.En son ki index.xhtml sayfasını paylaşmak istiyorum ve yazımı burada bitirmek istiyorum…
İndex.xhtml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <h:head></h:head> <body> <h:form> <h:panelGrid columns="2"> <f:facet name="header">Kullanıcı Kayıt</f:facet> <h:outputText value="İsim Girin :" /> <h:inputText value="#{deneme.pojo.isim}" /> <h:outputText value="Soyisim Girin :" /> <h:inputText value="#{deneme.pojo.soyisim}" /> <h:outputText value="E-Mail Girin :" /> <h:inputText value="#{deneme.pojo.mail}" /> <h:outputText value="Şifre Girin :" /> <h:inputText value="#{deneme.pojo.parola}"/> <h:column></h:column> <h:commandButton action="#{deneme.kaydet()}" value="Kaydet" /> </h:panelGrid> </h:form> </body> </html> |
Kodu bu şekilde düzenlediğimizde çalışıyor…Herkese bol kodlu günler sağlıcakla kalınız…
Emeğinize sağlık. Teşekkürler.
İyi günler bende aynı problemi Netbeans’de yaşıyorum. Yardımcı olur musnuz ?
javax.el.MethodNotFoundException: /index.xhtml @18,81 action=”#{newClass.yaz()}”: Method not found: class com.app.donate.blooddonate.NewClass.yaz()