java - javax.el.PropertyNotFoundException: The class 'com.springapp.mvc.Class' does not have the property 'Courses' -
this question has answer here:
here's model:
public class class { @manytomany(etc etc) @jointable(etc etc) public list<course> courses;
here's view:
<c:foreach items="${classes}" var="class"> <tr> <td>${class.classname}</td> <td> <c:foreach items="${courses}" var="course"> <input type="checkbox" <c:if test="${class.courses.contains(course)}"> checked</c:if>> ${course.coursename} </c:foreach> </td> </tr> </c:foreach>
the view produces 500 error:
javax.el.propertynotfoundexception: class 'com.springapp.mvc.class' not have property 'courses'.
el not properties getters:
public class anyclass { private string aproperty; private string getagetter() { // ... } }
${anyclass.aproperty}
fail, ${anyclass.agetter}
succeed.
to transform getter name el expression, "get" (or "is") prefix removed, , first char lowercased.
in case, guess getter name getcourses
, gives courses
. have use ${class.courses}
.
be aware not follow java naming conventions.
Comments
Post a Comment