XML报错:The reference to entity "characterEncoding" must end with the ';' delimite
解决方法:
在web.xml增加如下配置:
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
然后再改一下数据库连接
jdbc:mysql://localhost/mydb?useUnicode=true&characterEncoding=utf-8
然后在MYSQL软件中更改对应字段为UTF-8编码;
纠错结果:
在配置一个访问数据库的Url时,第一次设置的内容如下:
jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8,注意中间那个“&”,在xml中这个是读不出的,正确写法将“&”转义“&”:
jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8
分析:
有时候在使用xml作为配置文件的时候,应该要使用xml的编码规则来进行适当的设置。
下面给出xml中一些特殊符号的编码转换:
| < | < | 小于号 |
| > | > | 大于号 |
| & | & | and字符 |
| ' | ' | 单引号 |
| " | " | 双引号 |
XML报错:The reference to entity "characterEncoding" must end with the ';' delimite的更多相关文章
- Caused by: org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Sourc ...
- java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.
java关于报错:The reference to entity "characterEncoding" must end with the ';' delimiter. Java ...
- xml文件中配置JDBC源遇到问题 : The reference to entity "characterEncoding" must end with the ';' delimiter
数据源配置时加上编码转换格式后出问题了: The reference to entity"characterEncoding" must end with the ';' deli ...
- 在java的xml文件配置数据库URL地址时提示The reference to entity "characterEncoding" must end with the ';' delimiter.错误信息
配置数据库的URL<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message&quo ...
- android 程序中res/values-v14/styles.xml报错的解决办法
从旧的ADT迁移的新的ADT时, android 程序中res/values-v14/styles.xml报错: error: Error retrieving parent for item: No ...
- The reference to entity "characterEncoding" must end with the ';' delimiter
数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...
- The reference to entity "characterEncoding" must end with the ';' delimiter (Mybatis + Mysql)
数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...
- 新建maven工程时pom.xml报错
新建maven工程时,pom.xml报错:第一行报如下错误:multiple annotations found at this line后添加org.eclipse.m2e相关的plugin配置后, ...
- eclipse中Maven项目pom.xml报错:com.thoughtworks.xstream.io.HierarchicalStreamDriver
eclipse中创建Maven项目时 pom.xml报错:com.thoughtworks.xstream.io.HierarchicalStreamDriver 解决方案1.在pom文件中加入mav ...
随机推荐
- [UE4]制作视野图标
一.在PhotoShop中新建一个64px*64px,背景色为透明的文档 二.填充“图层1”为白色 三.添加蒙版图层,并将前景色设置为黑色 四.将“图层1”选择45°,并往上拖放至如图位置 五.选择渐 ...
- Linux中/目录扩容
1:原来的系统20G,目前增加到30G,我要把增加的10G扩容到/目录下 2:fdisk /dev/sda (对sda这块磁盘没有被使用的空间进行分区,联想Windows操作系统) 使用L ...
- 使用.mongorc.js移除哪些比较“危险”的shell辅助函数
切换到用户目录下 vi .mongorc.js var no = function(){ print("Not on my watch."); }; //禁止删除数据库 db.dr ...
- Http跨域
一.传统 ajax跨域访问是一个老问题了,解决方法很多,比较常用的是JSONP方法,JSONP方法是一种非官方方法,而且这种方法只支持GET方式,不如POST方式安全. 即使使用jQuery的json ...
- C++删除容器数据
// free the contents of the list; erase the list inline void ListDelete (list <void *> *pList) ...
- Java - 26 Java 数据结构
Java 数据结构 Java工具包提供了强大的数据结构.在Java中的数据结构主要包括以下几种接口和类: 枚举(Enumeration) 位集合(BitSet) 向量(Vector) 栈(Stack) ...
- Android软键盘遮挡布局问题;
布局被软键盘遮挡虽然不是什么大问题,但还是比较影响用户体验的:最让人恼火的是当前输入框被软键盘被遮挡,来看一下解决方法: 1.当前输入框被软键盘遮挡,仅把输入框显示出来,不改变整体布局: 设置Mani ...
- JS函数介绍
JS中函数中没有重载特性,并且调用俩个重名函数是看顺序的 即第2个会把第1个覆盖掉也就是在下面写的会覆盖上面写的, 举个例子 function box(num,num2){ return num+10 ...
- ORM、SQLAchemy
ORM.SQLAchemy orm英文全称object relational mapping,就是对象映射关系程序,简单来说就是类似python这种面向对象的程序来说一切皆对象,但是使用的数据库却都是 ...
- Java中的Map List Set等集合类
一.概述 二 set map list的区别 三. Collections类和Collection接口 四. List接口,有序可重复的集合 五. Set接口,代表无序,不可重复的集合 六. Map接 ...