I have a code as following:
FriendsList = new ArrayList()
....
ResultSet rs = st.executeQuery(Select);
while (rs.next()) {
Member member = new Member(rs);
FriendsList.add(member);
}
it successfully get the results and goes to constructor of Member class and add data to it. but once I try to access one of its properties using FriendsList property from my jsp file I run into following error:
"Caused by: javax.el.PropertyNotFoundException: Property 'Name' not found on type
application.Member"
Using Eclipse I have generated a completed list of setters and getters for every property of Member class as following:
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
The key is the conversion of "property name" to the method name. In general the getter name is obtained by taking the property name, uppercasing the first character and prepending "get".
So if you want to call the getName method the property is "name" with a lowercase n, not an uppercase N.
There are also many many special cases for properties that actually do start with uppercase letters and the like, but life is much simpler if you set it up so your property names always start with lower case letters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With