开发工具:Ideal

使用场景:Demo

前提:
       环境:Spring boot +Thymeleaf+easyui

引入thymeleaf模板引擎

 <html lang="en" xmlns:th="http://www.thymeleaf.org">
Html页面引入easyui需要的文件 <link href="/js/jquery-easyui-1.5.3/themes/gray/easyui.css" rel="stylesheet"/> <link href="/js/jquery-easyui-1.5.3/themes/icon.css" rel="stylesheet"/> <script src="/js/jquery-easyui-1.5.3/jquery.min.js"></script> <script src="/js/jquery-easyui-1.5.3/jquery.easyui.min.js"></script> <script src="/js/jquery-easyui-1.5.3/locale/easyui-lang-zh_CN.js"></script>

当以标签属性创建easyui组件时,页面正常显示。
以标签属性创建easyui组件:

 <table class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px"

        data-options="singleSelect:true,collapsible:true,url:'/getUsers',method:'get'">

     <thead>

         <tr>

             <th data-options="field:'id',width:80">Item ID</th>

             <th data-options="field:'name',width:100">姓名</th>

             <th data-options="field:'tel',width:80,align:'right'">电话</th>

         </tr>

     </thead>

 </table>

页面效果:

当以js形式创建组件时出现问题
以js创建easyui组件

 <table id="dg"></table>

 <script type="text/javascript">

     $(function(){

         $('#dg').datagrid({

             url: '/getUsers',

             method: 'get',

             title: '用户表',

             iconCls: 'icon-save',

             width: 800,

             height: 250,

             fitColumns: true,

             singleSelect: true,

             columns:[[

                 {field:'id',title:'Item ID',width:80},

                 {field:'name',title:'姓名',width:80},

                 {field:'tel',title:'电话',width:80}

             ]]

         });

     });

 </script>

效果:

后台报以下错误:

[THYMELEAF][http-nio-8080-exec-1] Exception processing template "user": Could not parse as expression: "

{field:'id',title:'Item ID',width:80},

{field:'name',title:'姓名',width:80},

{field:'tel',title:'电话',width:80}

" (template: "user" - line 26, col 27)

解决方式:

 <script type="text/javascript" >

改为

 <script type="text/javascript" th:inline="none">

总结:

在easyui页面中,script执行easyui自己的方法要加入:

 <script th:inline="none">

原文参考:https://blog.csdn.net/xlzwhq0000004/article/details/83144440

Spring boot+Thymeleaf+easyui集成:js创建组件页面报错的更多相关文章

  1. 【spring boot】使用注解@ConfigurationProperties读取配置文件时候 报错 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rocketmqAutoConfiguration': Unsatisfied dependenc

    如题,配置文件如下: #注册中心配置 eureka: instance: instanceId: ${spring.application.name}:${random.int} hostname: ...

  2. spring boot +Thymeleaf+mybatis 集成通用PageHelper,做分页

    controller: /**  * 分页查询用户  * @param request  * @param response  * @return  * @throws Exception  */ @ ...

  3. STS创建spring boot项目,pom.xml文件第一行报错

    亲测能用url地址:https://blog.csdn.net/jrx1995/article/details/100008552

  4. 关于spring boot 使用 mybatis plus INSERT的时候id报错

    mybatis plus 在INSERT的时候会默认自动设置插入id 我当时数据库采用的id自增. 在使用插入语句的时候并没有set  ID 但是它默认给了一大串 更改mybatis plus全局配置 ...

  5. Spring Boot 2.1.7 启动项目失败,报错: "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."

    一开始按照网上的很多解决办法是: 启动类头部声明@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class}),但是这样会排除 ...

  6. 9、Spring Boot 2.x 集成 Thymeleaf

    1.9 Spring Boot 2.x 集成 Thymeleaf 完整源码: Spring-Boot-Demos 1.9.1 在pom中引入依赖 <dependency> <grou ...

  7. spring boot + Thymeleaf开发web项目

    "Spring boot非常适合Web应用程序开发.您可以轻松创建自包含的HTTP应用.web服务器采用嵌入式Tomcat,或者Jetty等.大多数情况下Web应用程序将使用 spring- ...

  8. spring boot / cloud (三) 集成springfox-swagger2构建在线API文档

    spring boot / cloud (三) 集成springfox-swagger2构建在线API文档 前言 不能同步更新API文档会有什么问题? 理想情况下,为所开发的服务编写接口文档,能提高与 ...

  9. 【ELK】4.spring boot 2.X集成ES spring-data-ES 进行CRUD操作 完整版+kibana管理ES的index操作

    spring boot 2.X集成ES 进行CRUD操作  完整版 内容包括: ============================================================ ...

随机推荐

  1. (二叉树 bfs) leetcode 199. Binary Tree Right Side View

    Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod ...

  2. Mac 上有哪些鲜为人知且极大提高效率的工具?

    来源:知乎文章收录于:风云社区SCOEE,提供上千款各类mac软件下载 1. Focus  功能: 屏蔽影响你学习的网站.  同类软件:Self Control, Rescue Time  特点 ...

  3. Mysql查询数据库 整理

    一.       查询数据: 查询所有列:SELECT * FROM student; 查询指定列:SELECT id,NAME,gender FROM student; 格式:select字段名, ...

  4. storm集群配置

    环境:centos6.4软件:jzmq-master-----java与c++通讯的桥梁,有了它,就可以使用zeromp了storm-0.8.2zeromq-2.1.7-----号称史上最牛逼的消息队 ...

  5. 面向对象【day07】:知识点回顾(十一)

    本节内容 1.self关键字 2.封装 3.继承 4.静态方法 一.self关键字 作用:调用当前方法的对象 1 2 3 4 5 6 7 8 9 10 11 12 13 14 class Foo:   ...

  6. 6.适配器模式(Adapter Pattern)

    适配(转换)的概念无处不在......适配,即在不改变原有实现的基础上,将原先不兼容的接口转换为兼容的接口.例如:二转换为三箱插头,将高电压转换为低电压等.    动机(Motivate):    在 ...

  7. Linux记录-CPU指标介绍

    在linux的系统维护中,可能需要经常查看cpu使用率,分析系统整体的运行情况.而监控CPU的性能一般包括以下3点:运行队列.CPU使用率和上下文切换. 对于每一个CPU来说运行队列最好不要超过3,例 ...

  8. Linux 检查 外部设备 是否存在

    以 USB 为例,如果移植了udev,那么在usb插入的时候,/dev下面会出现usb有关的设备,同时,自动挂载到文件系统的某个节点 如果以文件系统usb对应的挂载点来检测USB是否插入,是不够严谨的 ...

  9. http请求参数中文乱码的问题

    如题,A项目带参数发送请求到B项目.刚开始还好,但是发觉 参数带中文 就出现问题了,变成了?? 解决方法:发送中文参数前先做处理 request.getSession().removeAttribut ...

  10. expdp和impdp导入导出用法【转】

    关于expdp和impdp exp和imp是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用.expdp和impdp是服务端的工具程序,他们只能在ORACLE服务端使用,不能在客户端使用.i ...