Javax.el.PropertyNotFoundException: 'Name' property not found by type

I have a code:

FriendsList = new ArrayList() .... ResultSet rs = st.executeQuery(Select); while (rs.next()) { Member member = new Member(rs); FriendsList.add(member); } 

it successfully receives the results and proceeds to the constructor of the Member class and adds data to it. but as soon as I try to access one of my properties using the FriendsList property from my jsp file, I encounter the following error:

  "Caused by: javax.el.PropertyNotFoundException: Property 'Name' not found on type application.Member" 

Using Eclipse I created a complete list of setters and getters for each property of the Member class as follows:

  public String getName() { return Name; } public void setName(String name) { Name = name; } 
+4
source share
1 answer

The key is to convert the property name to the method name. In general, the name of the recipient is obtained by taking the property name, upper case of the first character and adding "get".

So, if you want to call the getName method, this is a "name" property with lowercase n, and not uppercase N.

There are also many special cases for properties that actually start with uppercase letters, etc., but life is much easier if you set it up so that property names always start with lowercase letters.

+8
source

Source: https://habr.com/ru/post/1434328/


All Articles