Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javax.el.PropertyNotFoundException: Property 'Name' not found on type [duplicate]

Tags:

jsp

struts2

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;
}
like image 463
Eme Emertana Avatar asked Sep 15 '12 04:09

Eme Emertana


1 Answers

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.

like image 153
EdC Avatar answered Nov 02 '22 16:11

EdC