aspose file tools*
The moose likes JSF and the fly likes  The class '...' does not have the property '...'. 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 '...' does not have the property '...'.

Marius Schmidt
Greenhorn

Joined: Jan 11, 2013
Posts: 3
Hi. I'm searching for a while for a solution for the named Problem. But I didn't see a working solution for my Problem in other topics.
I am writing an JSF-Application using beans which are getting some Informations from a MySQL Database. But I have a problem getting these inormation, to the JSF-File.
Now the problem. I've got a xHtml-File ("index.xhtml") that just contains 2 inputTexts for setting an email and a Password. This seems to work. Because they could be shown at the next site ("Profil.xhtml") before. But now if I press the submit-Button the Browser shows this Error-Massage:
/Profil.xhtml @14,55 value="#{Benutzerdaten.Email}": The class 'Alumni.BeanBenutzerdaten' does not have the property 'Email'

My index.xhtml looks like this:



The site ("Profile.xhtml") that should show a Profile or something like that looks like this:



The important things of the Bean Benutzerdaten:



The get- and set-Methods are available for all Member-Variables.
The Class DAOBenutzerdaten shouldn't be the Problem because it worked in another application. The method readProfile() just reads the informations from Database and uses the set-Methods to save them to the bean.
I Hope the german words don't confuse you, but hope for help. Thank you for this. OneManArmy
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4420
    
    8

Hi Marius. Welcome to the Ranch!

I'm not certain it's causing the error, but the one thing that stands out is that according to the JavaBean conventions I think you should be referring to Benutzerdaten.email - note the case of the property name, and compare it to the way you're using Password.
Marius Schmidt
Greenhorn

Joined: Jan 11, 2013
Posts: 3
Ok. It works thank you. But then just one more question. Till now I thought, I have to write the name of the member variable. But what do I have to look for, for naming them right all the time? That's why I wrote it with a big Capital in JSF.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4420
    
    8

You need to follow the JavaBeans conventions. These are good practice in general for programming Java, but they become more important in JSF (or JSP) because they assume you are following them. That means that you use properties using lower-case in the JSF file, and the class needs to use getters and setters. So you should follow a pattern something like this:

which gives you a JavaBean property email.
Marius Schmidt
Greenhorn

Joined: Jan 11, 2013
Posts: 3
Ok. Thank you all.
In this case i start writing variables small, so the mistake shouldn't come again :p
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16134
    
  21

The capitalization rules for JSF are actually the capitalization rules for JavaBeans. Instance and property names begin lower-case, classnames begin uppercase. JSF will tolerate violations of these rules, but since it is assuming you are doing things properly, occasionally violators may experience unexpected problems.

Incidentally, "get" is not a good name prefix to use for an action method because it makes an executable function superficially appear to be a property retrieval method. I use "do" myself, although that's just a personal quirk.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The class '...' does not have the property '...'.