天天看點

An error happened during template parsing (template: “class path resource [xxxx]) 異常處理

問題描述:thymeleaf資料渲染報錯

出現此問題 多半是接口層渲染資料到頁面的問題。

往下滑可以明顯看到 報錯資訊裡标注的某一個屬性值為null或者不存在

Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "map.fromUser.headerUrl" (template: "/site/notice-detail" - line 33, col 12)
	at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) ~[attoparser-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at org.attoparser.MarkupParser.parse(MarkupParser.java:257) ~[attoparser-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
	... 82 common frames omitted

           

在接口層做處理 不允許為空 或者模闆上做非空處理 避免模闆渲染出錯