目录
源代码:
运行后页面加载不出来
查看控制台报的错误:
具体位置在最后一行显示出来了:
- 2022-12-03 15:55:30.937 ERROR 4756 --- [nio-8067-exec-7] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/ysu_bbs] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
- {field:'another_name',title: '昵称',
- templet: function(d){
- return d.user.another_name
- }
- }
- ,{field:'total_days', width:100, title: '总天数', sort: false}
- ,{field:'month_days', width:100, title: '月天数'}
- ,{field:'last_sign_time',width:240, title: '上次签到时间', minWidth: 150,
- templet: function(d){
- return util.toDateString(d.last_sign_time, 'yyyy-MM-dd HH:mm')
- }
- }
- /* ,{field:'experience', width:120, title: '目前等级', sort: false}*/
- ,{field:'last_award', width:120, title: '上次奖励', sort: false,
- templet: function(d){
- return d.last_award+' 积分'
- }
- }
- " (template: "/pages/sign" - line 183, col 26)] with root cause
-
- org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
- {field:'another_name',title: '昵称',
- templet: function(d){
- return d.user.another_name
- }
- }
- ,{field:'total_days', width:100, title: '总天数', sort: false}
- ,{field:'month_days', width:100, title: '月天数'}
- ,{field:'last_sign_time',width:240, title: '上次签到时间', minWidth: 150,
- templet: function(d){
- return util.toDateString(d.last_sign_time, 'yyyy-MM-dd HH:mm')
- }
- }
- /* ,{field:'experience', width:120, title: '目前等级', sort: false}*/
- ,{field:'last_award', width:120, title: '上次奖励', sort: false,
- templet: function(d){
- return d.last_award+' 积分'
- }
- }
- " (template: "/pages/sign" - line 183, col 26)
第一次试错:删除外层“ [ ]”此时,控制台不报错,页面可以加载出来,但是部分数据加载不出来。
最后经搜索后发现,因为[[…]]之间的表达式在thymeleaf被认为是内联表达式,所以渲染错误。
[
[
]
]
如图所示:
加上 th:inline="none"
在