Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javax.el.PropertyNotFoundException in a JSP page

I am getting an error in JSP and I cannot figure out what is causing it. I have included all of the appropriate libraries and I've made sure to follow bean convention on uppercase/lowercase. Here's the relevant code in the JSP:

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

The relevantData was a List<MyData>. For the purposes of this question it is sufficent to say MyData is a class that contains a Double named price (with a Getter and Setter following the bean convention). When I try to load this page I receive 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 do I fix it?

like image 965
Wallace Brown Avatar asked Jun 19 '12 21:06

Wallace Brown


1 Answers

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

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

like image 141
Wallace Brown Avatar answered Oct 15 '22 17:10

Wallace Brown