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 ...
随机推荐
- golang的垃圾回收(GC)机制
golang的垃圾回收采用的是 标记-清理(Mark-and-Sweep) 算法 就是先标记出需要回收的内存对象快,然后在清理掉: 在这里不介绍标记和清理的具体策略(可以参考https://lengz ...
- windows server 2008 R2 安装
微软服务器操作系统大致有: server 2000(简称2K),还有server 2003(2K3),server 2008(2K8),server 2000和2003是基于NT内核的,而2008是基 ...
- IBM MQ常用命令
常用命令 创建队列管理器crtmqm –q QMgrName-q是指创建缺省的队列管理器删除队列管理器dltmqm QmgrName启动队列管理器strmqm QmgrName如果是启动默认的队列管理 ...
- vue学习笔记-初始化一个vue项目(1)
1.cnpm install -g vue-cliUsage:vue init <template-name> <project-name> 2.我们一般使用webpack模版 ...
- C语言:结构体,共用体
结构体: 一个变量,存储不同类型的数据项共用体:一个变量,存储不同类型的数据项,相同的内存位置,存储不同的数据类型 #include <stdio.h> #include <stri ...
- HBase原理和架构
HBase是什么 HBase在生态体系中的位置 HBase vs HDFS HBase表的特点 HBase是真正的分布式存储,存储级别达到TB级别,而才传统数据库就不是真正的分布式了,传统数据库在底层 ...
- [java] 屏蔽ie浏览器中F1帮助
实现某一功能时需要屏蔽IE浏览器中的F1,F2快捷键. 百度后发现如下代码 var jq$ = jQuery.noConflict(); //防止$符号与其他的冲突 jq$(document).rea ...
- SpringBoot异步请求
何为异步请求 在Servlet 3.0之前,Servlet采用Thread-Per-Request的方式处理请求,即每一次Http请求都由某一个线程从头到尾负责处理.如果一个请求需要进行IO操作,比如 ...
- apt-get 常用命令总结
apt-get 高级包装工具(英语:Advanced Packaging Tools,简称:APT)是Debian及其衍生发行版(如:ubuntu)的软件包管理器.APT可以自动下载,配置,安装二进 ...
- 【Linux】【secureCRT】下载,安装,激活攻略
以前公司使用的是SSH访问Linux服务器,今天争取了能看到数据,问了同事使用的是secureCRT,然后自己就装了一个. 下载地址:https://www.vandyke.com/download/ ...