JSP頁面中出現了Page directive: illegal to have multiple occurrences of contentType with different values異常
阿新 • • 發佈:2018-11-20
頁面具體是這樣報錯的
HTTP Status 500 - /inc/common_head.jsp (line: 1, column: 2) Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html;charset=UTF-8, new: text/html; charset=UTF-8) type Exception report message /inc/common_head.jsp (line: 1, column: 2) Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html;charset=UTF-8, new: text/html; charset=UTF-8) description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: /inc/common_head.jsp (line: 1, column: 2) Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html;charset=UTF-8, new: text/html; charset=UTF-8)
頁面程式碼沒錯,我口頭翻譯了一下illegal to have multiple occurrences of contentType with different values,是包含頁面和被包含頁面的contentType設定不一樣
包含頁面原來的page指令是這樣的
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
被包含頁面原來的page指令是這樣的
<%@ page contentType="text/html; charset=UTF-8"%>
我把被包含頁面,也就是我異常中提示的/inc/common_head.jsp頁面中的page指令重新改成了包含頁面中的page指令,就解決了