• 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

error says Property not found in class but it actually exist

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Saloon Keeper
Posts: 27762
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

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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic