thymeleaf错误 org.xml.sax.SAXParseException: 在实体引用中, 实体名称必须紧跟在 ‘&’ 后面
在thymeleaf的js中使用&,<,>等符号时会产生这种问题,因为thymeleaf是采用xml解析的方式进行替换的,所以javascript中&这样的xml实体转义字符会被识别为转义,所以会出sax解析错误。
解决:使用
/*<![CDATA[*/
/*]]>*/
包裹代码块
<script>
/*<![CDATA[*/ function test() { $.ajax({
type: "POST",//方法类型
dataType: "json",//预期服务器返回的数据类型
contentType: 'application/json',
url: "xxxxx",//url
data: {},
success: function (result) { },
error: function () {
alert("异常!");
}
});
} /*]]>*/
</script>
在js代码中使用thymeleaf的表达式获取后端传的值
thymeleaf错误 org.xml.sax.SAXParseException: 在实体引用中, 实体名称必须紧跟在 ‘&’ 后面的更多相关文章
- org.xml.sax.SAXParseException;在实体引用中, 实体名称必须紧跟在 '&' 后面
错误信息如下:org.xml.sax.SAXParseException;在实体引用中, 实体名称必须紧跟在 ‘’&’’ 后面 出现这个错误的原因是在xml中使用&,实际上xml中不支 ...
- webServices接口开发过程中项目启动遇到的错误org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 422; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-bean
org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 422; schema_reference.4: Failed to read ...
- xml文件使用DOM解析,报异常org.xml.sax.SAXParseException,"characterEncoding" 的引用必须以 ';' 分隔符结尾异常
这个异常一般为xml文件对&的报错,只需要将&改为转义后的&即可解决
- springboot thymeleaf org.xml.sax.SAXParseException错误
SpringBoot越来越受欢迎,而官方推荐的模板是thymeleaf ,但是其语法太过严格,使用过程中一不留心就会出现org.xml.sax.SAXParseException错误 其中主要是下面这 ...
- spring整合mybatis错误:Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 62; 文档根元素 "mapper" 必须匹配 DOCTYPE 根 "configuration"。
运行环境:jdk1.7.0_17+tomcat 7 + spring:3.2.0 +mybatis:3.2.7+ eclipse 错误:Caused by: org.xml.sax.SAXParseE ...
- Spring错误——Spring xml注释——org.xml.sax.SAXParseException; lineNumber: 24; columnNumber: 10; cvc-complex-type.2.3: 元素 'beans' 必须不含字符 [子级], 因为该类型的内容类型为“仅元素”。
背景:配置spring xml,注释xml中文件元素 错误: Caused by: org.xml.sax.SAXParseException; lineNumber: 24; columnNumbe ...
- org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 语法分析器在此文档中遇到多个 "64,000" 实体扩展; 这是应用程序施加的限制
使用SAX解析XML文件.XML文件有1.5G,程序抛出了这个问题: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 语法 ...
- 坑爹的Hibernate 映射文件错误提示org.xml.sax.SAXParseException
今天整整一个上午都在和hibernate做斗争,早上一来,继续昨天的项目开发,发现spring项目不能启动,从错误中看是hibernate错误,多半是hibernate配置有错误,关键是错误提示中显示 ...
- org.xml.sax.SAXParseException: 元素类型 "input" 必须由匹配的结束标记 "</input>" 终止。
错误记录 Spring Boot推荐使用thymeleaf作为视图,按照SpringBoot实战一书的案例写Demo. 发生错误: org.xml.sax.SAXParseException: 元素类 ...
随机推荐
- C语言递归之对称二叉树
题目描述 给定一个二叉树,检查它是否是镜像对称的. 示例 二叉树 [1,2,2,3,4,4,3] 是对称的. / \ / \ / \ [1,2,2,null,3,null,3] 则不是镜像对称的. / ...
- 【VS开发】list控件的InsertColumn方法出错
今天在写一个获取磁盘信息的小程序,通过list控件显示各磁盘信息.我在属性页(CPropertyPage)的构造函数中,调用list控件的InsertColumn方法,编译链接都通过了,但运行时冒出了 ...
- PHP7 下安装 memcache 和 memcached 扩展
转载自:https://www.jianshu.com/p/c06051207f6e Memcached 是高性能的分布式内存缓存服务器,而PHP memcache 和 memcached 都是 Me ...
- java实验题目
1. 打印输出所有的“水仙花数”,所谓“水仙花数”是指一个3位数,其中各位数字立方和等于该数本身.例如,153是一个“水仙花数”. 实验源码: public class number1 { publi ...
- Minimum Number of Arrows to Burst Balloons
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided ...
- Zookeeper 配置和原理探究
一 Zookeeper是什么? 服务集群对外提供服务的过程中,有很多的配置需要随时更新,服务间需要协调工作,那么这些信息如何推送到各个节点?并且保证信息的一致性和可靠性?我们知道分布式协调服务很难正确 ...
- mybatis-plus配置多数据源invalid bound statement (not found)
mybatis-plus配置多数据源invalid bound statement (not found) 错误原因 引入mybatis-plus应该使用的依赖如下,而不是mybatis <de ...
- 骨牌摆放方案数n*m(状压DP)
题意:https://www.nitacm.com/problem_show.php?pid=1378 如题. 思路: 从第一行for到最后一行,枚举每一行的所有状态,进行转移,注意答案是dp[最后一 ...
- 用python实现自己的http服务器——多进程、多线程、协程、单进程非堵塞版、epoll版
了解http协议 http请求头 GET / HTTP/1.1 Host: www.baidu.com Connection: keep-alive Pragma: no-cache Cache-Co ...
- Python 基础(十七)--序列化
pickle模快 pickle.dumps():可将特有数据类型的转换为bytes类型 pickle.loads():将bytes类型转化回来 >>> import pickle & ...