java - javax.el.PropertyNotFoundException: The class 'com.springapp.mvc.Class' does not have the property 'Courses' -


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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -