错误信息:
Caused by: org.attoparser.ParseException: Could not parse as expression: " {type: "checkbox", width: "80"}, {field: "id", title: "用户ID", width: "80"}, {field: "user_name", title: "账号", width: "120"}, {field: "password", title: "密码", width: "120"}, {field: "real_name", title: "姓名", width: "150"}, { field: "type", title: "角色", width: "100", templet: function (d) { if (d.type == 1) { return "管理员"; } else if (d.type == 2) { return "业务员"; } } }, { field: "is_del", title: "状态", width: "100", templet: function (d) { if (d.is_del == 1) { return "<font color='green'>有效</font>"; } else if (d.is_del == 2) { return "<font color='gray'>无效</font>"; } } }, {title: "操作", width: "250", toolbar: "#rowBtns"} " (template: "User/list" - line 154, col 21) at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) at org.attoparser.MarkupParser.parse(MarkupParser.java:257) at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ... 48 more Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: " {type: "checkbox", width: "80"}, {field: "id", title: "用户ID", width: "80"}, {field: "user_name", title: "账号", width: "120"}, {field: "password", title: "密码", width: "120"}, {field: "real_name", title: "姓名", width: "150"}, { field: "type", title: "角色", width: "100", templet: function (d) { if (d.type == 1) { return "管理员"; } else if (d.type == 2) { return "业务员"; } } }, { field: "is_del", title: "状态", width: "100", templet: function (d) { if (d.is_del == 1) { return "<font color='green'>有效</font>"; } else if (d.is_del == 2) { return "<font color='gray'>无效</font>"; } } }, {title: "操作", width: "250", toolbar: "#rowBtns"} " (template: "User/list" - line 154, col 21)
原因:因为[[…]]之间的表达式在thymeleaf被认为是内联表达式,所以渲染错误
解决:
1.也就是把cols后的[[ ]]变为
[
[
]
]
2.
或者在<script type="text/javascript" > 加上 th:inline="none"
<script type="text/javascript" th:inline="none">
但是这样的话,前面在base中使用[[@{}]]的标签也不能解析了,所以还是使用第一种方案,以后可以根据情况来解决