Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Darryl A. J. Staflund
Ranch Hand
Posts: 314
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!