• Post Reply Bookmark Topic Watch Topic
  • New Topic

error says Property not found in class but it actually exist  RSS feed

 
nikhil katoch
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
greetings!!!
i have made a class (name=issue) that has a calendar attribute (name=from1). i am able to persist it in database. i am making a list of all database entries of issue class and giving this list as value of jsp data table. but when i execute it errors pops up saying attribute from1 not found on class issue. if i delete only this attribute, i am able to get the values in data table but when i add this calendar attribute, error pops up again.i am able to print this attribute's value on console (that ensures it exit) but on running jsp it says property not found??? how can i display this value in jsp data table???
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the property have getters and setters that conform to Java bean property naming standards?
 
nikhil katoch
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not made getters and setters of from1 attribute in managed bean as it is calculated automatically when object persist in database(though i have tried using getters and setters as well but didn't work )
my managed bean is IssuetoTO (doesn't have attribute form1 of type calendar)
whereas my entity class is Issueto (it has form1)
i am defining a method in IssuetoTO whose return type is a list of all Issueto object persisted in database. this list is a attribute of IssuetoTO. i am giving this list as value to data table. On executing it says form1 not found in Issueto??
(even if i make getter and setter of from1 then how will it be instantiated ???)
 
E Armitage
Rancher
Posts: 989
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to think about these class and variable names, especially if you want to use your POJOs in a Java bean context. IssuetoTO doesn't sound very descriptive and form1 is not any better.
You need getters and setters to be able to reference the properties from JSP page expression language. You may be able to get away with just getters these days depending on your stack versions.
Isn't the form1 populated by code that retrieves the results from the database? If so then the getter will retrieve the right value that was calculated during persist, no?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nikhil katoch wrote:I have not made getters and setters of from1 attribute in managed bean as it is calculated automatically when object persist in database


No it isn't.

In JPA, you can do either direct field access OR property get/set access (and I'm too lazy to look up the proper names for those options).

In JSF you cannot do that. The backing bean properties must be accessed in accordance with JavaBean standard rules, which means that explicit public get/set methods must be defined for the bean.

Also, beware of attempting to use ORM Domain Model objects directly as JSF UI Model objects. Because of the fundamental architectural differences, there are very few cases where that will work properly. In general, it's better to define a discrete UI Model object and use it as the fa├žade to the Domain Model object.
 
nikhil katoch
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Tim Holloway and and E Armitage. I got the concept and now i am able to populate form1 as well

thanks alot
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!