illegal to have multiple occurrences of contentType with different values (old: text/html; charset=UTF-8, new: text/html; charset=utf-8)

时间:2024-04-27 21:06:05
  • 问题描述:

在a.jsp通过<%@ include file="b.jsp" %> 的方式引入b.jsp,但是报了标题的中的错误,

  • 问题原因:

在a.jsp的头部:

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

在b.jsp的头部:

             <%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
发现a.jsp是小写的uft-8,而b.jsp是大写的UTF-8;
  • 解决方法:
          保持两者的头部一致:copy覆盖