参考:thymeleaf+layui加载页面渲染时TemplateProcessingException: Could not parse as expression: "_yaoshengting的博客-CSDN博客
目录
1.table渲染问题
2.解决方式
1.将clos后的[[ ]]分成四行写
2.加上 th:inline="none
1.table渲染问题
源代码:

运行后页面加载不出来

查看控制台报的错误:
具体位置在最后一行显示出来了:

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被认为是内联表达式,所以渲染错误。
2.解决方式
1.将clos后的[[ ]]分成四行写
[
[
]
]
如图所示:

2.加上 th:inline="none"
在 <script type="text/javascript" > 加上 th:inline="none"
<script type="text/javascript" th:inline="none">
但是这样,使用的[[@{}]]也就不能解析了。
![[附源码]Python计算机毕业设计Django拉勾教育课程管理系统](https://img-blog.csdnimg.cn/e6eb28991ac649869bde836b30f4148d.png)

![[附源码]JAVA毕业设计教学辅助系统(系统+LW)](https://img-blog.csdnimg.cn/6cf8c2ea58e144f092580a9a3209e14a.png)
![[附源码]计算机毕业设计springboo酒店客房管理系统](https://img-blog.csdnimg.cn/bef4bdd7237243499b89ce7c0ec23782.png)





![[附源码]计算机毕业设计疫情期间小学生作业线上管理系统Springboot程序](https://img-blog.csdnimg.cn/9c1d21fccde84676b435e0bed5e2e0b1.png)









