`

The reference to entity "characterEncoding" must end with the ';' delimiter

 
阅读更多

 在配置Spring 的数据源的时候,想把url配置下面加一个mysql数据库的编码格式的处理..

 

刚开始是这么写的:

 <property name="url" value="jdbc:mysql://localhost:3306/portal?useUnicode=true&characterEncoding=utf-8"/>

 

启动服务,就提示

The reference to entity "characterEncoding" must end with the ';' delimiter

错误.

 

后面改成:

<property name="url" value="jdbc:mysql://localhost:3306/portal?useUnicode=true&amp;characterEncoding=utf-8"/>

 

就没错误了,因为在解析的时候,会进行转义操作.

 

在xml文件中有以下几类字符要进行转义替换:

 

 

&lt;

 

<

 

小于号

 

&gt;

 

>

 

大于号

 

&amp;

 

&

 

 

&apos;

 

'

 

单引号

 

&quot;

 

"

 

双引号

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics