<form id="form1" name="form1" action="designer/GKD_submitSuccess?filevalue=<s:property value="filevalue"/>" method="post">struts配置文件中设置如下
<constant name="struts.i18n.encoding" value="gb2312"/>其中每个jsp中pageEncoding="gb2312"求助............

解决方案 »

  1.   

    这问题我也碰到过,你改为method=“get”就不乱码了,如果method=“post”就必须用过滤器,没别的办法
      

  2.   

    果断点加过滤器吧。。
    private String encoding = "UTF-8"; public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain arg2) throws IOException, ServletException { request.setCharacterEncoding(encoding);
    response.setCharacterEncoding(encoding);
    arg2.doFilter(request, response); }
      

  3.   

    你项目是GBK就把,UTF-8改为GBK吧。。
      

  4.   


    过滤器,struts配置文件常量设置,jsp中pageEncoding都设置好了   都是gb2312.......
      

  5.   

    Struts2乱码终极解决办法
      

  6.   

    JSP: <%@ page contentType="text/html; charset=GBK"%>
      

  7.   

    而且我在action方法里写了个控制台输出,为什么会输出两次???方法不是执行一次吗??
      

  8.   

    如果你是用<input type="image"/>这种形式来触发提交表单的话,我遇到过会执行两次。如果是这种情况不要在写document.form1.submit就可以了!
      

  9.   

    你的参数是中文字符吧?
    我也遇到过这样的问题,提交之后在后台先做一下转码,转过码的参数就是你要的啦!
    String filevalue= new String(request.getParameter("filevalue").getBytes("ISO-8859-1"),"gb2312");
      

  10.   

    String filevalue= new String(request.getParameter("filevalue").getBytes("ISO-8859-1"),"gb2312");
    或者
    <%@ page contentType="text/html; charset=GBK"%>
    或者
    request.setCharacterEncoding(“utf-8”);
    response.setCharacterEncoding(“utf-8”);
      

  11.   

    两种解决办法:1  在 action里过滤编码。
    2 使用过滤器过滤编码。
      

  12.   

    浏览器传递表单参数时编码用的UTF-8,而tomcat默认的接收参数(封装为request对象)编码为ISO-8859-1,所以传中文时乱码了
    解决办法
    1 在过滤器中设置request.setCharacterEncoding(“utf-8”);又由于tomcat在载入filter的时是按web.xml配置的filter顺序载入的,所以在web.xml配置时,这个过滤器要放在struts的filter前.
    2 String filevalue= new String(request.getParameter("filevalue").getBytes("ISO-8859-1"),"utf-8")
    ps:不知道你的struts版本是好多,我知道2.16版的中文过滤器有问题
      

  13.   

    我今天也遇到了,把method改成post就好了