Thymeleaf报错org.thymeleaf.exceptions.TemplateProcessingException Could not parse as expression

Thymeleaf报错org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: “***”

问题描述

在使用layui初始化table的时候,报了这个错

org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
                {field: 'name', title: '角色名称', align: 'center'},
                {field: 'remark', title: '角色备注', align: 'center'},
                {field: 'createTime', title: '创建时间', align: 'center'},
                {fixed: 'right', title: '操作', toolbar: '#roleRowBar', align: 'center', width: 280}
            " (template: "system/role/roleManager" - line 133, col 21)

来看看我初始化表头是怎么写的:

cols: [[
    {field: 'name', title: '角色名称', align: 'center'},
    {field: 'remark', title: '角色备注', align: 'center'},
    {field: 'createTime', title: '创建时间', align: 'center'},
    {fixed: 'right', title: '操作', toolbar: '#roleRowBar', align: 'center', width: 280}
]],

感觉和官方文档写的没啥区别啊,为啥就会报错呢~~~

问题解决

问题解决,都是在一个偶然的情况下,乱搞把[[]]之间加个空格,如[ [。这个问题就莫名其妙的解决了!?

cols: [ [
    {field: 'name', title: '角色名称', align: 'center'},
    {field: 'remark', title: '角色备注', align: 'center'},
    {field: 'createTime', title: '创建时间', align: 'center'},
    {fixed: 'right', title: '操作', toolbar: '#roleRowBar', align: 'center', width: 280}
] ]

就很离谱😵​
在这里插入图片描述

编程到最后可能编的都是玄学了吧😆

如果有大佬知道为原因的可以评论告诉小弟哟~~~

2025-05-23 15:11:38.317 ERROR 19484 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : 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/register.html]")] with root cause org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "@{/user/login" (template: "register" - line 34, col 31) at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:131) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:62) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:44) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.engine.EngineEventUtils.parseAttributeExpression(EngineEventUtils.java:220) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.engine.EngineEventUtils.computeAttributeExpression(EngineEventUtils.java:207) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.standard.processor.AbstractStandardExpressionAttributeTagProcessor.doProcess(AbstractStandardExpressionAttributeTagProcessor.java:125) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEASE] at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.0.15.RELEASE.jar:3.0.15.RELEA
05-24
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值