直接访问errorpage.jsp不是乱码,但是通过web-xml跳转之后,就显示成???????了,为什么呢ErrorPagr.jsp如下
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>错误提示</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<body onload="tishi();">
<% 
    response.setStatus(200); // 200 = HttpServletResponse.SC_OK 
%>
<center><h3>原因可能有:数据库连接错误,网络断开或者长时间没有操作导致连接丢失等等。</h3></center>
</body>
</html>web.xml 如下:
<?xml version="1.0" encoding="UTF-8"?>
  <error-page>
     <error-code>500</error-code>
     <location>/system/errorPage.jsp</location>
  </error-page>
  <error-page>
     <error-code>404</error-code>
     <location>/system/errorPage.jsp</location>
  </error-page>
  <error-page>   
    <exception-type>java.lang.Exception</exception-type>   
     <location>/system/errorPage.jsp</location>   
  </error-page>
  <error-page>   
    <exception-type>java.sql.SQLException</exception-type>   
     <location>/system/errorPage.jsp</location>   
  </error-page>
</web-app>

解决方案 »

  1.   

    很明显你的程序在相应的时候字符编码有问题,把你响应请求的那个serlvet或者action什么的响应的字符编码改成UTF-8的就成了
      

  2.   

    你好,楼主!
    嗯,楼上的说的没错。
    在web.xml 配置好编码方式吧。
      

  3.   


    在servlet里面已经设了UTF-8了
    还有一点就是,在MyEclipse里面运行,怎么都没错,但是我把class直接拷到Tomca Webapps里面运行,就会出现乱码
      

  4.   

    遇到了和你一模一样的问题。我是Tomcat 5.5 Jdk1.5 所有都是UTF-8单独指向的时候正常,Tomcat自动跳转时就乱码了。 (filter 设置字符集部分应该未工作。)但单独设置request、response字符集仍没有用.待解决~!
      

  5.   

    JSP头部设置:<%@ page contentType="text/html; charset=UTF-8"%>如果是乱码,我想是你的Eclipse编辑格式不是UTF-8的,还有一种可能就是你的服务器编码设置的不是UTF-8形式