Caused by: org.attoparser.ParseException: Could not parse as expression: "
{type: 'numbers'},
{field: 'name', title: 'name'},
{field: 'id', title: 'id'},
{field: 'sex', title: 'sex'},
{field: 'pid', title: 'pid'}
" (template: "backadmin/menu/menuIndex" - line 69, 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)
... 53 common frames omitted
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
{type: 'numbers'},
{field: 'name', title: 'name'},
{field: 'id', title: 'id'},
{field: 'sex', title: 'sex'},
{field: 'pid', title: 'pid'}
" (template: "backadmin/menu/menuIndex" - line 69, col 25)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:131)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:62)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:44)
at org.thymeleaf.engine.EngineEventUtils.parseAttributeExpression(EngineEventUtils.java:220)
at org.thymeleaf.engine.EngineEventUtils.computeAttributeExpression(EngineEventUtils.java:207)
at org.thymeleaf.standard.processor.AbstractStandardExpressionAttributeTagProcessor.doProcess(AbstractStandardExpressionAttributeTagProcessor.java:125)
at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74)
at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95)
at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633)
at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314)
at org.thymeleaf.engine.TemplateHandlerAdapterMarkupHandler.handleOpenElementEnd(TemplateHandlerAdapterMarkupHandler.java:304)
at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler$InlineMarkupAdapterPreProcessorHandler.handleOpenElementEnd(InlinedOutputExpressionMarkupHandler.java:278)
at org.thymeleaf.standard.inline.OutputExpressionInlinePreProcessorHandler.performInlining(OutputExpressionInlinePreProcessorHandler.java:440)
at org.thymeleaf.standard.inline.OutputExpressionInlinePreProcessorHandler.handleText(OutputExpressionInlinePreProcessorHandler.java:146)
JS中對應的代碼以下javascript
layui.config({
//base: '../../../../static/plugins/layui/extend/'
base: '[[@{/static/plugins/layui/extend/}]]'
}).extend({
treetable: 'treetable-lay/treetable'
}).use(['layer', 'table', 'treetable'], function () {
var $ = layui.jquery;
var table = layui.table;
var layer = layui.layer;
var treetable = layui.treetable;
// 渲染表格
var renderTable = function () {
layer.load(2);
treetable.render({
treeColIndex: 1,
treeSpid: -1,
treeIdName: 'id',
treePidName: 'pid',
treeDefaultClose: true,
treeLinkage: false,
elem: '#table1',
url: '[[@{/static/data.json}]]',
page: false,
cols: [[
{type: 'numbers'},
{field: 'name', title: 'name'},
{field: 'id', title: 'id'},
{field: 'sex', title: 'sex'},
{field: 'pid', title: 'pid'}
]],
done: function () {
layer.closeAll('loading');
}
});
};
renderTable();
});
解決方式java
1.也就是把cols後的[[ ]]變爲jquery
[express
[json
]app
]ui
由於[[…]]之間的表達式在thymeleaf被認爲是內聯表達式,因此渲染錯誤url
2.或者在<script type="text/javascript" > 加上 th:inline="none".net
<script type="text/javascript" th:inline="none">
可是這樣的話,前面在base中使用[[@{}]]的標籤也不能解析了,因此仍是使用第一種方案,之後能夠根據狀況來解決。
---------------------
做者:ystyaoshengting
來源:CSDN
原文:https://blog.csdn.net/ystyaoshengting/article/details/84773952
版權聲明:本文爲博主原創文章,轉載請附上博文連接!orm