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 ...
随机推荐
- 一次聊天引发的思考--java并发包
一次聊天,谈到了死锁的解决.可重入锁等等,突然发现这些离自己很远,只有一些读书时的概念涌入脑海,但各自的应用场景怎么都无法想出.痛定思痛,决定看看concurrent包里涉及并发的类及各自的应用场景. ...
- [UE4]传送门:场景切换
- vue todolist 1.0
<template> <div id="app"> <input type="text" v-model='todo' /> ...
- bootstraptable学习(2)分页
1.分页需要配置一些参数 function init() { $('#bootstrapModel').bootstrapTable({ url: "../Listing.ashx" ...
- SAS数据集推送到sql server 数据库 实现代码段
libname fdsas ODBC datasrc=fdsas user=fdsas password=fdsas123 preserve_tab_names=yes connection=shar ...
- 第8章 传输层(7)_TCP连接管理
7. TCP连接管理 7.1 TCP的连接建立 (1)三次握手 ①三次握手过程 A.第1.2次握手,数据包的SYN均为1,表示用于同步.即第1次客户端发起请求,并将自己的连接参数(如接收窗口大小.MS ...
- gulp 使用案例
1.gulp 配置: // 引入 gulp var gulp = require('gulp'); var watch = require('gulp-watch'), //导入所有gulp需要的模块 ...
- Java 2-Java 对象和类
Java 对象和类 Java作为一种面向对象语言.支持以下基本概念: 多态 继承 封装 抽象 类 对象 实例 方法 消息解析 本节我们重点研究对象和类的概念. 对象:对象是类的一个实例,有状态和行为. ...
- REST framwork之认证,权限与频率
认证组件 局部视图认证 在app01.service.auth.py: class Authentication(BaseAuthentication): def authenticate(self, ...
- centos7 安装Node.js并配置为全局可用
本文Node.js版本为5.12.0,登录 https://nodejs.org/dist/v5.12.0/,需指定其他版本的话可以直接修改版本号进行登录. 为了方便使用tar命令对文件进行解压,我们 ...