我这有一段简单的代码:
<%-- 使用此语句处理显示中的乱码 --%>
<%@page contentType="text/html;charset=gb2312"%>
<html>
<head>
    <title>include demo</title>
</head>
<body>
<%@include file="incl.jsp"%>
<%@include file="incl.txt"%>
<%@include file="incl.inc"%>
</body>
</html>用Tomcat6运行,结果显示,如下:
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unsupported encoding: gb2312
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
    org.apache.jasper.compiler.JspUtil.getReader(JspUtil.java:1048)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:210)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.怎么办啊?拜托了各位!

解决方案 »

  1.   

    在Tomcat/conf/service.xml下添加:
    ...
    <Connector port="8080" protocol="HTTP/1.1" 
              connectionTimeout="20000" 
              redirectPort="8443" disableUploadTimeout="true" URIEncoding="GBK"/>
    ....
    就可以了
      

  2.   

    Tomcat/conf下的service.xml文件
    ...
        <Connector port="8200" protocol="HTTP/1.1" 
                   connectionTimeout="20000" 
                   redirectPort="8443" disableUploadTimeout="true" URIEncoding="GBK"/>
    ....
      

  3.   

    <%@page contentType="text/html;charset=gb2312"%> 
    org.apache.jasper.JasperException: Unsupported encoding: gb2312 
    换成别的诸如gbk或者utf8
    或者客户指定的或者你指定的编码
      

  4.   

    <%@page language="java" contentType="text/html;charset=gb2312"%>
      

  5.   

    我的service.xml中有    <Connector port="8080" protocol="HTTP/1.1" 
                           maxThreads="150" connectionTimeout="20000" 
                           redirectPort="8443" />
    这样一段代码,换成你给的那样还是不好使啊,是Tomcat6.x么?