我用<%@ include file="header.jsp"%>就不会出现乱码,而用<jsp:include page="header.jsp"></jsp:include> 就要出现乱码,这是为什么呢?我在页面开始都加了<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

解决方案 »

  1.   

    加上这一句 <%@ page contentType="text/html;charset=GB2312"%>
      

  2.   

    后一句需要编译,中文字符到JVM里传递有可能会产生乱码。
      

  3.   

    回复人: 007JavaKing(猛将兄) ( ) 信誉:95  2005-11-02 09:21:00  得分: 0  
     
     
       后一句需要编译,中文字符到JVM里传递有可能会产生乱码。
      
     -----------------------------------
      

  4.   

    jsp页面保存到数据库有乱码解决方法Jsp+tomcat+bean中文乱码问题解决方法javabean中参数有乱码
    1) 所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
    2) 在应用服务器中的server.xml方件中找到设置服务器端口的行,一般是这样开头:”<Connector port="8080"”,
    3) 在找到的行"<Connector"开头的字符串后加上:URIEncoding="UTF-8" ,保存文件
    --------------------------------------------------------------------------
    jsp页面有乱码解决方法    所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
        <%@ page contentType="text/html; charset=UTF-8">
    --------------------------------------------------------------------------
    jsp单个中文参数乱码解决方法    用这个转换一下: 
        <%!String trans(String chi)
           {
            string result =null;
            byte temp[];
            temp=chi.getBytes("iso=8859-1");
            result= new String(temp);
            }
        %>
    或者直接这样:
        <% 
          request.setCharacterEncoding("UTF-8");
          out.println(request.getParameter("参数ID")
        %>
    --------------------------------------------------------------------------
      

  5.   

    这个最简单
    try
    {
    this.text1=new String(text1.getBytes("ISO-8859-1"),"GBK");
    }
    catch(Exception e1)
    {
    }