严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /jsp.jsp(1,2) Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html; charset=UTF-8, new: text/html; carset=UTF-8)
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)
at org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:126)
at org.apache.jasper.compiler.Node$PageDirective.accept(Node.java:550)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
at org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:93)
at org.apache.jasper.compiler.Node$IncludeDirective.accept(Node.java:598)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
at org.apache.jasper.compiler.Validator.validateDirectives(Validator.java:1441)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:158)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:326)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:307)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
主文件:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@ include file="jsp.jsp" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
今天的日期是:<%=(new java.util.Date()).toLocaleString()%>
<!-- -->
</body>
</html>
插入文件:
<%@ page language="java" contentType="text/html; carset=UTF-8"
pageEncoding="UTF-8" %>
<html>
<head>
<title>test.jsp</title>
</head>
<body> </body>
</html>
看红色标记处!!!!文件第一行改成一样的即可。