File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The class '<name>' does not have the property '<name>'.

 
Michael van Adrichem
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I've seen some topics about this but none of them really helped me find my awnser.

This is the problem:

I have a XHTML page with a button that has a logout function:



As you can see. This button has to do 2 things.
1. Do the action practicebean.kill (works perfectly)
2. Onclick it has to do: Personeelbean.kill and the method uitlogen()

The methode uitlogen works fine. But the PersoneelBean.kill just isnt working.

I get this error:
SEVERE: Error Rendering View[/HoofdschermKoffieruimte/FrameBoven.xhtml]
javax.faces.FacesException: javax.el.PropertyNotFoundException: /HoofdschermKoffieruimte/FrameBoven.xhtml @97,121 onclick="#{PersoneelBean.kill}; uitlogen()": The class 'Mapping_Files_POJOS.PersoneelBean' does not have the property 'kill'.

So i have the PersoneelBean:


What am i doing wrong? I just dont get it.
Especialy since the practicebean.kill is exactly the same and that one IS working...

Please help...

Greetings,
Michael
 
Vance Montague
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The actionListener property will execute the code properly. Here's how it looks:





The actionListener property specifies managed bean code to run when that button is clicked. The difference between this and the action property is the action property must be a string equal to one of your navigation rules - this can be hard-coded, or returned from a managed bean function (as you have done with action="#{PracticeBean.kill}"). actionListener, on the other hand, must be a function in the managed bean with an ActionEvent parameter. It does not forward the page afterwards, like the action property does. Both of these properties, however, call the bean code when the button is clicked.

onclick, however, is just a string specifying the javascript to run when the button is clicked.

<h:commandButton onclick="jsfunction();" /> renders to something along the lines of <input type="button" onclick="jsfunction()">

Referencing a JSF bean in this property is valid, but the key is that it runs when the page renders and expects a String value to be returned to fill in the property.



within bean class:


This is valid and the resulting page will render to something like this:

<input type="button" onclick="foo();">
 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, you're referring to your bean's class, not the bean itself...


It should be



 
Michael van Adrichem
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vance Montague, Thank you verry much.

This was exactly my problem and now it works.

you have no idea how long i struggled with this easy looking problem :p

Thank you for your explanation too.

And Guy deLyonesse it is also working now with the capital The name of the bean is also with a capital.

Greetings,

Michael
 
Stevo Slavic
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my case issue was that project built using Maven declared jsf 2.0 implementation as compile and runtime dependency, and jsf 1.2 api as provided dependency, and was deployed on glassfish 2.1.1 which provides jsf 1.2 api and implementation. Application would deploy, but rendering view would throw exception that a property was not found on backing bean, for an action binding.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic