js中免不了的要用的数组,一维的二维的三维的

但是当用到thymeleaf作为模版时候会有一些坑,导致数组不能用

org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
{checkbox: true, fixed: true}
, {field: 'originalFileName', title: '文件名', width: , sort: true}
, {field: 'fileType', title: '文件类型', width: }
, {field: 'fileSize', title: '文件大小', width: , sort: true}
, {field: 'createTime', title: '上传时间', width: , sort: true}
, {field: 'dpStatus', title: '数据处理状态', width: , templet: '#statusTpl', sort: true}
, {field: 'updateTime', title: '数据处理完成时间', width: , templet: '#updateTimeTpl', sort: true}
, {fixed: 'right', title: '操作', align: 'center', width: , toolbar: '#operating'}
" (template: "textManagement" - line 125, col 22)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:)
at org.thymeleaf.engine.EngineEventUtils.parseAttributeExpression(EngineEventUtils.java:)

这里只接触最外层异常,而出现异常的位置

<script>
var cols=[[
{field:'checkBox',checkbox: true, fixed: true}
,{field:'username', title: '用户名'} //width 支持:数字、百分比和不填写。你还可以通过 minWidth 参数局部定义当前单元格的最小宽度,layui 2.2.1 新增
,{field:'mobile', title: '手机号', sort: true}
,{field:'nickname', title: '昵称'}
,{field:'lastLoginTime', title: '最后登录时间'}
,{field:'ip', title: '最后登录ip', align: 'center'} //单元格内容水平居中
,{field:'op',title: '操作', align:'center', toolbar: '#toolBars'} //这里的toolbar值是模板元素的选择器
]];
</script>

thymeleaf会把[[]]中的内容作为内联取值块解析,而不是数组。可以在cols的后面换行

解决办法:
方法一:回车换行如下:

, cols: [
[ //表头
{field: 'xxx', title: 'ID', width: , sort: true, fixed: 'left'}
, {field: 'xxx', title: '记录日期', width: }
, {field: 'xxx', title: '操作人ID', width: , sort: true}
, {field: 'xxx', title: '', width: }
, {field: 'xxx', title: '签名', width: }
, {field: 'xxx', title: '积分', width: , sort: true}
, {field: 'xxx', title: '评分', width: , sort: true}
, {field: 'xxx', title: '职业', width: }
, {field: 'xxx', title: '财富', width: , sort: true}
]
]

方法二:或者在script标签里 th:inline="none" 就可以了,默认是th:inline="text"

<script th:inline="none">
</script>

thymeleaf 使用javascript定义数组报错的更多相关文章

  1. JavaScript实现弹窗报错

    JavaScript实现弹窗报错 1.具体错误如下 SCRIPT 5022:cannot call methods on dialog prior to initialization; attempt ...

  2. java使用类数组 报错Exception in thread "main" java.lang.NullPointerException

    源代码如下: Point[] points=new Point[n];//Point是一个类 for(int i=0;i<n;i++) { System.out.print("请输入x ...

  3. springAOP注解方式定义切入点报错error at ::0 can't find referenced pointcut

    [说明] 1.使用spring版本:4.0.4 2.springAOP相关依赖包: 1)aopalliance-1.0.jar 2)aspectjweaver-1.8.9.jar 3)aspectjr ...

  4. mybatis问题。foreach循环遍历数组报错情况,及其解决方法

    根据条件查询数据列表,mybatis查询代码如下 如果只查询属于特定部门拥有的数据权限.这需要用 String[ ] codes保存当前部门及其子部门的部门编码. 所以需要在mybatis中遍历编码数 ...

  5. 解决关于ARM_MATH数学库宏定义的报错

    昨天在建立新工程的时候发现加入含有ARM_MATH库的时候出现了宏定义报错. #error directive:"Define according the used Cortex core ...

  6. mysql 创建函数或者存储过程,定义变量报错

    报错的原因是因为在过程或者函数中存在分隔符 分号(:),而mysql中默认分隔符也是 :,这就导致存储过程分开了 在存储过程外面包一层 delimiter //   code  //就行了

  7. Arcgis Javascript中geometryEngine报错’hq‘of undefined的解决方法

    这个问题困扰了我一个星期,原因是使用geomagicbuffer时候,有的线可正常使用,有的就直接报错,一直没有解决,后来发现是api自己的bug导致的 干脆直接读代码,在geometryEngine ...

  8. NSUserDefaults保存对象数组报错

    在使用NSUserDefaults的时候插入数据有时候会报以下错误:Attempt to set a non-property-list objec 这种错误的原因是插入了不识别的数据类型,NSUse ...

  9. <JavaScript>调用apply报错:CreateListFromArrayLike called on non-object;

    Function.apply(obj, args)方法能接收两个参数 obj:这个对象将代替Function类里this对象 args:这个是数组,它将作为参数传给Function(args--> ...

随机推荐

  1. UVa 10214 - Trees in a Wood.(欧拉函数)

    链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  2. Servlet 处理请求

    一:Servlet 处理请求也是通过request来进行处理,类似于python. get请求通过request.getparameter("key");key为前端传过来的key ...

  3. http协议中的keeplive是做什么的?它的适应场景是什么?

    1.Http底层也是通过TCP传输的. 2.HTTP keep-alive Http是一个”请求-响应”协议,它的keep-alive主要是为了让多个http请求共享一个Tcp连接,以避免每个Http ...

  4. iOS 开发:深入理解 Xcode 工程结构(一)转

    当我们新建一个 Cocoa 项目时,Xcode 会提供一系列的模板,类似前端的脚手架工具,只需要简单的几个选项,就可以配置好一个项目所需的基本环境. 这些基本环境配置一般包括: 编译选项.证书链选项 ...

  5. 偏前端 - jquery-iframe内触发父窗口自定义事件-

    例如父窗口定义了一个事件. top: $(dom1).bind('topEvent', function(){}); 那么iframe里面的元素怎样触发父窗口dom1的事件呢?这样吗? $(dom1, ...

  6. Phpstorm如何连接服务器

    当服务器是Linux的时候不懂指令觉得很懊恼,这个时候直接就可以使用PHPstorm连接服务器操作了: 1丶准备工作 首先你先要准备服务器丶phpstorm这两个吧! 2丶开始配置phpstorm 按 ...

  7. GoLand Dep Integration Project

    Dep integration 标签(空格分隔): Go 1. 通过 GoLand 使用 dep integration 创建项目 参见 Dep integration 使用 dep integrat ...

  8. iOS Swift WisdomKeyboardKing 键盘智能管家SDK

    iOS Swift WisdomKeyboardKing 键盘智能管家SDK [1]前言:    今天给大家推荐个好用的开源框架:WisdomKeyboardKing,方面iOS日常开发,优点和功能请 ...

  9. [转]Docker 生产环境之配置容器 - 限制容器资源

    默认情况下,容器没有资源限制,可以使用主机内核调度程序允许的给定资源.Docker 提供了一些方法来控制容器可以使用多少内存.CPU 或块 IO,并设置 docker run 命令的运行时配置标志.本 ...

  10. springboot快速入门(一)——HelloWorld搭建

    一.起步 1.先导 凡技术必登其官网的原则,官网走一波:https://projects.spring.io/spring-boot/#quick-start 极力推荐一个springboot教程:h ...