<label class="label">授课教师</label>
<p class="content" id="teacher">
<span th:if="${course!=null}"
th:each="i:${course.teachers}"
th:text="${i}+'<br>'">
</span>
</p>如果后台传过来的是一个空对象怎么办啊,这样会报错,一直找不到解决方法。
Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "course.teachers" (template: "index" - line 126, col 19)
at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) ~[attoparser-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.attoparser.MarkupParser.parse(MarkupParser.java:257) ~[attoparser-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.thymeleaf.templateparser.up.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
... 52 common frames omitted
<p class="content" id="teacher">
<span th:if="${course!=null}"
th:each="i:${course.teachers}"
th:text="${i}+'<br>'">
</span>
</p>如果后台传过来的是一个空对象怎么办啊,这样会报错,一直找不到解决方法。
Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "course.teachers" (template: "index" - line 126, col 19)
at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) ~[attoparser-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.attoparser.MarkupParser.parse(MarkupParser.java:257) ~[attoparser-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.thymeleaf.templateparser.up.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
... 52 common frames omitted
解决方案 »
- 新手求帮助 登陆验证模块
- 关于hibernate中的setEntity和setParameter?
- 在mysql中约束
- 请问用JSP能实现对比2个word文档异同吗?
- 哪里有isapi_redirector2.dll下载呀?(急呀!)
- 如何在网上找兼职工作
- 用Hibernate或Tomcat的连接池,在SQLServer中,然后程序中,每次用Connection的时候,都是进行事务处理,结果,过了一段时间,就报错说“
- servlet 和 javaBean运行环境配置
- 有效性验证问题,这个该怎样实现好呢?
- spring mvc事务无法回滚
- 使用XMLSerializer XML转json发现一个问题,需要后台处理!!!请教大神
- mybatis 打印Preparing : sql select ............. where id = ?时,是已经获得了连接还是没有拿连接
th:each="i:${course.teachers}"
th:text="${i}+'<br>'">
</span>
空就是false
比如: 写入0或1
th:each="i:${course.teachers}"
th:text="${i}+'<br>'">
</span>
th:text="${i}+'<br>'">
</span>
给需要判断的对象加一个问号就可以!