第一种尝试:分开前后两个中括号
当直接使用layui的table实例代码时,我们可能会出现以下错误
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Jan 23 15:20:18 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
An error happened during template parsing (template: "class path resource [templates/Page/test/test.html]")
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/Page/test/test.html]")
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241)
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.attoparser.ParseException: Could not parse as expression: "
{field: 'code', width: 80, title: 'ID', sort: true},
{field: 'name', width: 100, title: '用户名'},
{field: 'age', width: 80, title: '年龄'},
{field: 'gender', width: 80, title: '性别'},
{field: 'create_time', width: 80, title: '创建时间'},
{field: 'update_time', width: 80, title: '修改时间'},
" (template: "Page/test/test" - line 57, col 25)
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)
... 64 more
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
{field: 'code', width: 80, title: 'ID', sort: true},
{field: 'name', width: 100, title: '用户名'},
{field: 'age', width: 80, title: '年龄'},
{field: 'gender', width: 80, title: '性别'},
{field: 'create_time', width: 80, title: '创建时间'},
{field: 'update_time', width: 80, title: '修改时间'},
" (template: "Page/test/test" - line 57, col 25)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:131)
可以参考以下链接所示的办法进行解决
layui数据表格 table.render 报错的解决办法(IT技术)
当我使用如下方式解决问题时,上述的异常会消失,但会出现另外一个新的异常
新异常如下所示
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: " “
发现其这种办法无法解决问题。可能是我使用有问题。
第二次尝试:[[和]]之间加个空格,如[ [和] ]
这样就不会出现第一次尝试时所出现的异常。