Spring boot+Thymeleaf+easyui集成:js创建组件页面报错
开发工具: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创建组件页面报错的更多相关文章
- 【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: ...
- spring boot +Thymeleaf+mybatis 集成通用PageHelper,做分页
controller: /** * 分页查询用户 * @param request * @param response * @return * @throws Exception */ @ ...
- STS创建spring boot项目,pom.xml文件第一行报错
亲测能用url地址:https://blog.csdn.net/jrx1995/article/details/100008552
- 关于spring boot 使用 mybatis plus INSERT的时候id报错
mybatis plus 在INSERT的时候会默认自动设置插入id 我当时数据库采用的id自增. 在使用插入语句的时候并没有set ID 但是它默认给了一大串 更改mybatis plus全局配置 ...
- 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}),但是这样会排除 ...
- 9、Spring Boot 2.x 集成 Thymeleaf
1.9 Spring Boot 2.x 集成 Thymeleaf 完整源码: Spring-Boot-Demos 1.9.1 在pom中引入依赖 <dependency> <grou ...
- spring boot + Thymeleaf开发web项目
"Spring boot非常适合Web应用程序开发.您可以轻松创建自包含的HTTP应用.web服务器采用嵌入式Tomcat,或者Jetty等.大多数情况下Web应用程序将使用 spring- ...
- spring boot / cloud (三) 集成springfox-swagger2构建在线API文档
spring boot / cloud (三) 集成springfox-swagger2构建在线API文档 前言 不能同步更新API文档会有什么问题? 理想情况下,为所开发的服务编写接口文档,能提高与 ...
- 【ELK】4.spring boot 2.X集成ES spring-data-ES 进行CRUD操作 完整版+kibana管理ES的index操作
spring boot 2.X集成ES 进行CRUD操作 完整版 内容包括: ============================================================ ...
随机推荐
- 字符类型char、字符串与字符数组、字符数组与数据数组区别
字符类型是以ASCII码值运算的:小写字母比相应的大写字母大32,其中A=65,a=97 Esc键 27(十进制).'\x1B'(十六进制).'\33'(八进制) 转义字符:\0 空字符 AS ...
- (四点共面) 51nod1265 四点共面
1265 四点共面 1 秒 131,072 KB 0 分 基础题 给出三维空间上的四个点(点与点的位置均不相同),判断这4个点是否在同一个平面内(4点共线也算共面).如果共面,输出"Ye ...
- mysql加速source导入数据
mysql加速source导入数据 # 进入mysql中执行如下 ; ; ; ; -- 你的sql语句1 -- 你的sql语句2 -- 你的sql语句3 ; ; ; ;
- go vendor管理Golang项目依赖
解决的问题 将源码拷贝到当前工程的vendor目录下,这样打包当前的工程代码到任意机器的$GOPATH/src下都可以通过编译. govendor 1.安装 go get -u -v github.c ...
- 理解I/O:随机和顺序
转自:https://blog.csdn.net/BaiWfg2/article/details/52885287 原文:http://www.violin-memory.com/blog/under ...
- Hadoop生态圈-使用FreeIPA安装Kerberos和LDAP
Hadoop生态圈-使用FreeIPA安装Kerberos和LDAP 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 有些大数据平台只是简单地通过防火墙来解决他们的网络安全问题.十分 ...
- 读写锁ReadWriteLock
为了提高性能,Java提供了读写锁,在读的地方使用读锁,在写的地方使用写锁,灵活控制,如果没有写锁的情况下,读是无阻塞的,在一定程度上提高了程序的执行效率. Java中读写锁有个接口java.util ...
- Java Web之表单重复提交问题
上篇文章讲了验证码的制作,提及到了一个问题,就是表单重复提交的问题,可能在上次那个验证码中感觉不是那么的重要 现在我新写一个例子,转钱.通过这个例子你就知道表单重复提交有多恐怖了. 先来简单的介绍一下 ...
- java io系列18之 CharArrayReader(字符数组输入流)
从本章开始,我们开始对java io中的“字符流”进行学习.首先,要学习的是CharArrayReader.学习时,我们先对CharArrayReader有个大致了解,然后深入了解一下它的源码,最后通 ...
- [NIO-3]Socket通道
Socket通道 上文讲述了通道.文件通道,这篇文章来讲述一下Socket通道,Socket通道与文件通道有着不一样的特征,分三点说: 1.NIO的Socket通道类可以运行于非阻塞模式并且是可选择的 ...