jsp错误解决:Page directive: illegal to have multiple occurrences of contentType with different

After the project is running jsp page error

ARN:oejsh.ErrorHandler:qtp1335520301-21: EXCEPTION 
org.apache.jasper.JasperException: /WEB-INF/views/include/_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)
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:275)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:107)
    at org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:135)
    at org.apache.jasper.compiler.Node$PageDirective.accept(Node.java:571)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
    at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
    at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
    at org.apache.jasper.compiler.Node$Root.accept(Node.java:464)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
    at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
    at org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:101)
    at org.apache.jasper.compiler.Node$IncludeDirective.accept(Node.java:635)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)

Solve the problem

The original page is included with the contentType inconsistent @page directive contains pages inside, carefully check the first line of the two @page file that contains the page is:

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

Included page:

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

Sure enough, contentType the content inside is not the same, the two files @page contents of the first row of the change to be consistent, then the implementation of the program, run by.
Here Insert Picture Description

Suggest

Recommended to replace the whole amount in the project: all jsp pages plus @page header content value to be consistent.

Published 129 original articles · won praise 8 · views 20000 +

Guess you like

Origin blog.csdn.net/ll837448792/article/details/104380441