开发者社区> 问答> 正文

java报错:The reference to entity "characterEncoding"

java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

错误信息提示代码类似如下:

The reference to entity "characterEncoding" must end with the ';' delimiter. org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

ontext initialization failed org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

展开
收起
Dynastys 2021-10-21 10:20:28 744 0
1 条回答
写回答
取消 提交回答
  • 纠错结果: 在配置一个访问数据库的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字符 ' ' 单引号 " " 双引号

    2021-10-21 10:21:35
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载