Javax.el.PropertyNotFoundException on JSP page

I get an error message in JSP and I cannot figure out what causes it. I have included all the relevant libraries, and I have necessarily complied with the bean convention for uppercase / lowercase letters. Here is the relevant code in the JSP:

<c:forEach items="${relevantData}" var="entry"> <p>${entry.price}</p> </c:forEach> 

relevantData was List<MyData> . For the purposes of this question, it suffices to say that MyData is a class that contains a price called Double (using Getter and Setter following the bean convention). When I try to load this page, I get the following error in the server logs (Tomcat 7.0.22):

 javax.el.PropertyNotFoundException: Property 'price' not readable on type java.lang.Double 

Why am I getting this error and how to fix it?

+8
java jsp el jstl netbeans
source share
1 answer

The problem was caused by the visibility of the MyData class. I had the generated MyData class generated by Netbeans, but I did not notice that the public keyword was not in front of the class name. This meant that by the time he got into the JSP, there was no way to read the properties in MyData .

I changed the type to public and the problem was resolved.

+22
source share

All Articles