Albertxu1 2017-01-04 04:59 采纳率: 33.3%
浏览 7791
已采纳

thymeleaf循环后台list集合出错

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'...。

  • 写回答

3条回答 默认 最新

  • 宝贝安妮 2017-01-04 07:28
    关注

    你的tr是不是要把td包裹起来图片说明

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch