使用jsp做了一个web系统,在xp下运行正常,移植到win7下后,发现form表单传递的值中文支持不了,页面使用的是GBK。

解决方案 »

  1.   

    这个应该是你win7开发环境编码格式的问题,更改移植后项目的编码吧。
      

  2.   

    我的意思是让你看看win7中的myeclipse你导入的工程后,工程的编码!
      

  3.   

    工程的编码是使用的默认的,GBK
      

  4.   

    您的form表单提交方式是什么啊,是get还是post?
      

  5.   

    同意楼上,我的web项目也是在win7x64下开发,在xp或win7x32下运行,没有针对此问题特殊处理毫无问题的。
      

  6.   

    谢谢,我做了一下测试,form表单post方式提交没有问题,超链接传参就有问题。
      

  7.   

    做了过滤器和编码格式转化之后,找到了问题所在,问题是tomcat的server.xml中的设置问题。和系统没有关系。现有配置部分修改如下:
    <Connector port="8080" protocol="HTTP/1.1" 
         connectionTimeout="20000" redirectPort="8443" URIEncoding="GBK" />结贴!谢谢各位!
      

  8.   

    我查了一下,这个Connector的URIEncoding设置貌似是对Post和Get都有效的If your POST and GET parameters are not UTF-8 encoded when using Tomcat 5.x, try to adjust the Connector configuration in Tomcats server.xml like this:
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
       <Connector port="8080" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true"
                   URIEncoding="UTF-8"
       />http://struts.apache.org/2.3.4/docs/how-to-support-utf-8-uriencoding-with-tomcat.html