GeeCON Prague 2014*
The moose likes JSF and the fly likes The class '<name>' does not have the property '<name>'. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "The class Watch "The class New topic
Author

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

Michael van Adrichem
Greenhorn

Joined: May 20, 2011
Posts: 7
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

Joined: May 13, 2011
Posts: 6
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

Joined: Apr 12, 2011
Posts: 200

Also, you're referring to your bean's class, not the bean itself...


It should be



Michael van Adrichem
Greenhorn

Joined: May 20, 2011
Posts: 7
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

Joined: Apr 11, 2011
Posts: 2
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.
 
GeeCON Prague 2014
 
subject: The class '<name>' does not have the property '<name>'.