contentType 'text/xml; charset=UTF-8' conflicts问题

Resin升级到3.1.3后,有同事发现原来在Resin 3.0.xx下成功运行的部分jsp文件(输出xml格式文件)编译出错: 

1
2
3
4
5
6
7
500 Servlet Exception
XXXXX.jsp:1: contentType 'text/xml; charset=UTF-8'
conflicts with previous value of contentType 'text/html; charset=UTF-8'.
Check the .jsp and any included .jsp files for conflicts.
 
1:  <%@ page language="java" contentType="text/xml; charset=UTF-8" %>
2:  <%@ page 



经反复测试,发现是文件格式问题。 

解决方法: 

解决方法: 

用UltraEdit编辑JSP,另存为UTF-8 BOM格式 发现不报错,但是有乱码,存为ANSI/ASCII就没有乱码且不报错了

原文地址:https://www.cnblogs.com/yuhuameng/p/3865969.html