appointment.html页面表格:
控制器:
@controller
@RequestMapping("/appointment")
public String appointment(Model model) {
List results= appointService.getAppoint();
logger.info("开始获取后台预约信息!");
for (Appoint appoint : results) {
System.out.println(appoint);
}
model.addAttribute("appoints",results);
return "appointment";
}
实体类:
public class Appoint implements Serializable{
private long appointId;
private String name;
private String telphone;
private Integer studentNumber;
private String school;
private String telphoneTwo;
private Integer lectureNumber;
//getter和setter及toString方法省略
}
报错:
org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'appointId' cannot be found on null;
开发工具及框架:
idea2016.2.5、springboot1.4.2+thymeleaf2.1.5+springMVC+SqlServer2008
其它描述:foreach循环能够正确的打印出实体集合,
Appoint{appointId=210, name='sdf ', telphone='asdf ', studentNumber=3, school='asdf', telphoneTwo='asdf ', lectureNumber=4}
但是在实体类里idea提示getter方法没有被使用,且html页面循环体下的循环变量appoint提示Cannot resolve 'appoint'...。