美文网首页
layui和thymeleaf集成注意事项

layui和thymeleaf集成注意事项

作者: 繁书_ | 来源:发表于2019-01-07 15:26 被阅读0次

    在使用layui模板进行表格渲染时,如图所示,在cols中有两个“[[”(中括号)并列,导致在跳转到此页面时报以下错误

    
    Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/system/menulist.html]")] with root cause
    
    org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
    
                    {type:'numbers'}
    
                    ,{type:'checkbox',sort:true}
    
                    ,{field:'name', width:300, title: '菜单名称',edit:'text',sort:true}
    
                    ,{field:'url', width:300, title: 'url',edit:'text'}
    
                    ,{field:'id',width:100, title: 'id',sort:true}
    
                    ,{field:'pid', title: 'pid',sort:true}
    
                    ,{width:100,title: '操作', align:'center'/*toolbar: '#barDemo'*/
    
                        ,templet: function(d){
    
                            var html='';
    
                            var addBtn='<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="add">添加</a>';
    
                            var delBtn='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
    
                            return addBtn+delBtn;
    
                        }
    
                    }
    
                " (template: "system/menulist" - line 96, col 22)
    
    
    image
    • 解决方法:将两个中括号拆开
    image

    相关文章

      网友评论

          本文标题:layui和thymeleaf集成注意事项

          本文链接:https://www.haomeiwen.com/subject/ddmurqtx.html