• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javax.el.PropertyNotFoundException: /index.xhtml @30,79 action="#{Link.Lname}": Target Unreachable,

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why am i getting this error:

javax.el.PropertyNotFoundException: /index.xhtml @30,79 action="#{Link.Lname}": Target Unreachable, identifier 'Link' resolved to null



here is my jsf page


here my Link bean


here is a database class to feed link bean




this is how i connect the database when tomcat starts



And finally this is my web.xml file



what is cause of this error?
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is all I really needed to know:


javax.el.PropertyNotFoundException: /index.xhtml @30,79 action="#{Link.Lname}": Target Unreachable, identifier 'Link' resolved to null



It tells me that you don't know JavaBeans. JavaBeans are a very important part of the Java universe, and are employed by many Java products, not just JSF, so it's essential that you should learn their rules.

I recommend that you find some good learning resources, but here are some starting points.

JavaBeans are very much sensitive to capitalization. The best-practice rule for JavaBeans, and in fact for Java in general is that class names should start with an uppercase letter. Instance names, property names and other second-class names must not.

So right off, you've committed a double offence. Your bean instance name is "Link", with a capital L and its Lname property name does too.

While JSF can allow a bean instance name to start with an uppercase letter (even though it is discouraged), you didn't put a @Named attribute on your class, and therefore the default name rule applies, which is to name the bean instance the same name as the class [b]except that the first letter is folded down to lower-case[/i]. So your View Template requested a bean named "Link", but JSF would have defined it with a name of "link". When it went to resolve, it would find nothing and silently return a null pointer.

Were that not so, JSF might have figured out that the way to reference the "Lname" property on the Link bean was via the getLname and setLname methods, although that could vary. Nevertheless, since the bean pointer itself is null, attempting to reference ANY property of the Link bean would result in the resolver's throwing a PropertyNotFound exception, because there's no bean to examine.

I could go into detail about the fact that your database code is both poor for performance and reliability reasons, but you need to study up on JavaBeans first. Until you get that right, nothing else matters.
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic