HTTP ERROR 500
Problem accessing /mvc/student/getList. Reason:
The class 'java.lang.String' does not have the property 'studentId'.
Caused by:
javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'studentId'.
at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:579)
StudentController代码如下:
@RequestMapping("getList")
public ModelAndView getList() {
ModelAndView mav = new ModelAndView();
List<Student> list = studentService.getList(null);
mav.addObject("list",list);
mav.setViewName("studentList");
return mav;
}
studentList.jsp代码如下:
<c:forEach var="st" items="${list} ">
<tr>
<td>${st.studentId}</td>
<td>${st.name}</td>
<td>${st.sex}</td>
<td>${st.home}</td>
<td>操作</td>
</tr>
</c:forEach>
问题出在foreach标签的items上,{list}之后多了一个空格。只能自认手贱,敲多了一个空格。