Page directive: illegal to have multiple occurrences of contentType with different values问题解决
程序员文章站
2022-05-01 17:30:12
question:
page directive: illegal to have multiple occurrences of contenttype with different values...
question:
page directive: illegal to have multiple occurrences of contenttype with different values
(old: text/html; charset=utf-8, new: text/html;charset=utf-8)
analysis:
出现这个的原因是这两个的contenttype设置不一致所导致的。
当一个jsp include 另一个jsp时contenttype不一致的时候就会报这个错误。
案发现场
当前jsp <%@ page contenttype="text/html;charset=utf-8" language="java" %>
被include的jsp <%@ page contenttype="text/html;charset=utf-8" language="java" %>
本次报错是因为utf-8和utf-8所导致的。
answer:
把当前的jsp和被引入的jsp的contenttype设置一样就行。
都改成一样就ok了
<%@ page contenttype="text/html;charset=utf-8" language="java" %>