Exception processing template “admin/table“: Could not parse as expression: “(thymeleaf与layui冲突)
問題描述
使用thymeleaf+layui在頁面渲染的時候出現如下錯誤
[THYMELEAF][http-nio-8080-exec-7] Exception processing template “admin/table”: Could not parse as expression: "
這里是JS中的文件字段
{type: “checkbox”, width: 50},
{field: ‘adminId’, width: 80, title: ‘ID’, sort: true},
{field: ‘adminType’, width: 80, title: ‘類型’},
{field: ‘adminName’, width: 80, title: ‘姓名’, sort: true},
{field: ‘adminCreateTime’, width: 80, title: ‘創建時間’},
{field: ‘adminPosition’, title: ‘部門ID’, minWidth: 150},
{field: ‘adminStatus’, width: 80, title: ‘狀態’, sort: true},
{field: ‘loginIp’, width: 80, title: ‘上次登錄的ip’, sort: true},
{title: ‘操作’, minWidth: 150, toolbar: ‘#currentTableBar’, align: “center”}
錯誤分析
Could not parse as expression:無法解析為表達式
根據報錯的地方提示,我來來看看為什么會說這是一個表達式呢,這明明就是我的js字段。
在代碼中,它是這樣的
thymeleaf中,可以這么取數據[[${model}]],問題就出現在了這里,thymeleaf認為[[是它自家的,我就是要解析,但是又解析不出來。
解決方案
js屬于弱類型編程語言,thymeleaf屬于強類型語言,只要在中間加個空格或者回車即可,如下圖所示
總結
以上是生活随笔為你收集整理的Exception processing template “admin/table“: Could not parse as expression: “(thymeleaf与layui冲突)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: docker镜像底层是文件联合系统
- 下一篇: docker镜像为什么要采用分层结构