运行JSP页面显示正常,当 从JSP页面提交到Action后,再从Action跳转到JSP页面,页面上的中文显示的是乱码。不管跳转到哪个页面都是。请问这是怎么回事?望高手相助!先谢谢了!

解决方案 »

  1.   

    http://family168.com/tutorial/jsp/html/jsp-ch-02.html#jsp-ch-02-02中文乱码问题。
      

  2.   

    String str = request.getParameter("参数");
    if(str != null && !"".equals(str)) {
    str = new String(str.getBytes("iso-8859-1"), "GBK"); 
    }这样转一下试试
      

  3.   

    request.setCharacterEncoding("UTF-8");response.setContentType("text/html;charset=utf8");
      

  4.   

    如是Tomcat 记得进行相应的编码设置O!!!!!!!!!
    URIEncoding="utf-8"
      

  5.   

    lz你要写个过滤器 才能解决问题 写个过滤类,然后在web.xml下配置你的过滤器
      

  6.   

    过滤器是最常用的东西,你可以学习写个过滤器,对你以后可能碰到的字符集问题很有帮助的,记得要在web.xml进行配置。
      

  7.   

    jsp页面上注意
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">,在类中注意
    request.setCharacterEncoding("UTF-8"); 
    response.setContentType("text/html;charset=UTF-8");
    得到参数是乱码时:str = new String(str.getBytes("iso-8859-1"), "GBK");jsp文件、java文件格式也要注意
      

  8.   

    写个过滤器是比较简单的方法,
    过滤器中设置request.setCharacterEncoding(String s);s跟你jsp中用的编码一致即可.
    最主要的是web.xml中配置过滤器,拦截url /*,即所有请求。
      

  9.   

    看下http://www.duohuo.net/cms/article/view/19.html,解决jsp乱码问题