`

illegal to have multiple occurrences of contentType with different values 错误

    博客分类:
  • jsp
 
阅读更多
引用http://blog.csdn.net/kongtoubudui/article/details/7689216

JSP 解决illegal to have multiple occurrences of contentType with different values错误
在一个项目jsp文件中包含了另一个jsp文件(proCitySelAll.jsp),执行出现如下错误:
2012-5-14 16:37:04 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /lightworkflow/sheet/depponOrder/proCitySelAll.jsp(1,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: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:132)
at org.apache.jasper.compiler.Node$PageDirective.accept(Node.java:608)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:99)
at org.apache.jasper.compiler.Node$IncludeDirective.accept(Node.java:656)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Validator.validateDirectives(Validator.java:1723)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:182)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hollycrm.service.system.web.PageCacheFilter.doFilter(PageCacheFilter.java:50)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hollycrm.service.license.LicenseFilter.doFilter(LicenseFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hollycrm.service.system.security.web.filter.LoginUserInfoFilter.doFilter(LoginUserInfoFilter.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hollycrm.framework.web.filter.RequestEncodeFilter.doFilter(RequestEncodeFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hollycrm.service.system.web.PageCacheFilter.doFilter(PageCacheFilter.java:50)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.NET.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)

proCitySelAll.jsp 代码是没有错的,因为在其它页面调用没有出错过。那么是主文件出错了,看了一下刚写的页面全是静态内容,没什么的?
仔细阅读错误信息:
Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html; charset=utf-8,new: text/html;charset=utf-8)
原来是包含页面与被包含页面的@page指令里面的contentType不一致,仔细检查两个文件第一行的 @page,

包含页面的是: <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

被包含页面: <%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>

果然contentType="text/html;和charset=utf-8"之间多了一个空格,把两个文件第一行的@page内容改为一致,再执行程序,运行通过。

总结:被包含页面和包含页面必须都加上@page 头内容这个asp正好相反的,而且值要一致

如果你是 <%@ include file="/WEB-INF/jsp/common/head.jsp"%>
那么改为<jsp:include page="/WEB-INF/jsp/common/head.jsp" >

如果你是<jsp:include page="/WEB-INF/jsp/common/head.jsp" >
那么改为<%@ include file="/WEB-INF/jsp/common/head.jsp"%>

分享到:
评论

相关推荐

    AD错误中英文对照.pdf

    该部分包含了12项总线电气错误,涵盖了bus indices out of range、Bus range syntax errors、Illegal bus range values、Illegal bus definitions、Mismatched bus label ordering、Mismatched bus/wire object on ...

    AES加密出现InvalidKeyException之Illegal key size解决方案

    今日遇到如下错误:java.security.InvalidKeyException: Illegal key size 因为美国法律限制,JAVA默认支持AES 128 Bit 的key, 如果你计划使用 192 Bit 或者 256 Bit key, java complier 会抛出 Illegal key size ...

    DXP_错误对照

    A:Violations Associated with Buses 有关总线电气错误的各类型(共12项) ◆bus indices out of range 总线分支索引超出范围 ◆Bus range syntax errors 总线范围的语法错误 ◆Illegal bus range values 非法的...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    CRACKING CODES WITH PYTHON An Introduction to Building and Breaking Ciphers

    Chapter 23 that implement part of the RSA cipher would be illegal to export out of the United States. Because messages encrypted with RSA are impossible to hack, the export of encryption software like...

    JSP Simple Examples

    ArrayIndexOutOfBoundException is thrown when we have to indicate that an array has been accessed with an illegal index. printStackTrace in jsp printStackTrace is a method of the Throwable class. By ...

    illegal access to protected memory(解决方案).md

    illegal access to protected memory(解决方案).md

    AltiumDesigner(DXP)错误提示解释可用.pdf

    3. Illegal bus range values:非法的总线范围值。 4. Illegal bus definitions:定义的总线非法。 5. Mismatched bus label ordering:总线分支网络标号错误排序。 6. Mismatched bus/wire object on wire/bus:...

    piriform碎片整理大师

    - Updates may be licensed to you by Piriform with additional or different terms but Piriform has no obligation to provide any updates. - This License is the entire agreement between you and us and ...

    解决illegal Key Size jdk7版本

    在Java开发过程中,有时会遇到“illegal key size”这样的错误,这通常是由于Java加密相关的安全限制所导致的。这个问题在 JDK 7 版本中尤为常见,因为默认配置的Java Cryptography Extension (JCE) 有对密钥长度的...

    解决java.security.InvalidKeyException: Illegal key size

    在Java编程环境中,有时会遇到一个常见的错误:"java.security.InvalidKeyException: Illegal key size"。这个错误通常是由于Java安全策略的限制导致的,尤其是当你尝试使用超过默认限制的密钥长度(例如,超过128位...

    C语言常见错误查询,查询运行时出现的错误

    Call to function with no prototype 在C语言中,我们不能调用没有函数原型的函数,否则会出现错误。 Cannot modify a const object 在C语言中,不能修改常量对象,否则会出现错误。 Case outside of switch 在...

    VB编程资源大全(英文源码 其它)

    &lt;END&gt;&lt;br&gt;85,Shape.zip I have used SHAPE command instead of PARAMETERS to generate dynamic report.Open with VB6. &lt;END&gt;&lt;br&gt;86,AlarmPrj.zip An Alarm Class project. &lt;END&gt;&lt;br&gt;87,hyperlink.zip A ...

    BlueToolInstall

    Licensee shall be solely responsible for, and Broadcom shall have no obligation to honor, any warranties that Licensee provides to its customers or to end users with respect to the Software or ...

    DRC规则检查常见错误[参考].pdf

    3. Illegal bus range values(非法的总线范围值):非法的总线范围值将导致设计错误。 4. Illegal bus definitions(定义的总线非法):定义的总线非法将导致设计错误。 5. Mismatched bus label ordering(总线...

    Protel中ERC错误中英对照大全

    * Illegal bus range values:非法的总线范围值 * Illegal bus definitions:定义的总线非法 * Mismatched bus label ordering:总线分支网络标号错误排序 * Mismatched bus/wire object on wire/bus:总线/导线错误...

    AES加密时抛出java.security.InvalidKeyException: Illegal key size or default parameter

    同时,文中也提到了另一种常见的异常`javax.crypto.IllegalBlockSizeException: Input length not multiple of 16 bytes`,并提供了相应的解决方案,如数据填充和选择适当的加密模式等。遵循这些步骤,可以帮助...

    javaAES错误解决办法java.security.InvalidKeyException:illegal

    如在加密过程中出现下面异常: java.security.InvalidKeyException:illegal Key Size 请将两个jar文件按下列操作完成: 如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件;如果安装了...

    polycom宝利通视频会议软件3.9 2018

    If you have received the SOFTWARE PRODUCT for purposes of evaluation (“Demonstration”) or you have purchased a Laboratory or Developer License then this SOFTWARE PRODUCT is licensed to you per the ...

    illegal opcode 红屏报错(hp 360 G6安装win2021)问题解决方法.docx

    illegal opcode 错误是指在计算机启动过程中出现的致命错误,常见于操作系统安装或升级过程中。该错误会导致计算机无法启动,出现红屏报错。 illegal opcode 错误的原因可能是多种的,包括硬件问题、软件问题、BIOS...

Global site tag (gtag.js) - Google Analytics