thymeleaf+layui加载页面渲染时报错
作者:互联网
将freemaker替换成thymeleaf时出现以下问题:
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
{field:'id', title:'编号'},
{field:'username', title:'用户名'},
{field:'password', title:'密码'},
{field:'nickname', title:'昵称'},
{fixed:'right',title:'操作',toolbar:'#barDemo'}
" (template: "users" - line 96, col 22)
但是这个地方纯粹是使用layui进行的表格渲染,推测是某个表达式跟thymeleaf重复了。查证之下发现[[…]]之间的表达式在thymeleaf被认为是内联表达式,所有要将[[]]分隔开来。
table.render({
elem: '#demo'
,url:'/users/list'
,toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
,defaultToolbar: ['filter', 'exports', 'print']
,title: '用户数据表'
,cols: [
[
{field:'id', title:'编号'},
{field:'username', title:'用户名'},
{field:'password', title:'密码'},
{field:'nickname', title:'昵称'},
{fixed:'right',title:'操作',toolbar:'#barDemo'}
]
]
,page: true
});
解决问题。
标签:barDemo,title,layui,field,thymeleaf,表达式,toolbar,加载 来源: https://www.cnblogs.com/ljunn/p/15167983.html