This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Comment on Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Comment on "No Getter Method for Property..." Error" Watch "Comment on "No Getter Method for Property..." Error" New topic
Author

Comment on "No Getter Method for Property..." Error

Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi all,
Well I just spent a lot of time trying to address a "No Getter Method for Property..." error and though I would post my findings here for posterity.
My code was structured as follows when the error occured:
1. I had defined an abstract class C1 that in turn defined an abstract method M1 as follows:

2. I had also defined several package-scoped concrete classes C2, C3, etc. which extended C1 and its abstract M1. They took on the following form:

These classes are created using a Factory class.
3. I create a collection K populated with instances of abstract class C1.
4. When I try to iterate over collection K in my JSP page and try to display the value returned by method M1, a "No Getter Method for Property..." error arises. I don't really know why it arises as the method is defined in C1, albeit abstractly.
*****
Anyway, to make a long story short, the solution to the problem was to make method M1 a concrete method in abstract class C1. Only after I do this can I display the value returned by M1.
I guess I don't know enough about the JavaBeans specification to understand why the getter method has to be concretely defined in abstract class C1. In any event, this is a COMMON error that many Struts developers encounter so I hope this posting will prevent a lot of frustration to other users.
Cheers,
Darryl
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Comment on "No Getter Method for Property..." Error
 
Similar Threads
How to call the overridden method?
Overloading
how to use super
Garbage collection doubt
Help with Dan's Chapter 6, exam 1, question 8.