post提交:

  设置实体内容的编码:request.setCharacterEncoding("utf-8");

  注意:一定要在获取所有参数之前设置,否则设置无效!

get方式提交

  (1)手动进行参数的解码

    String paramValue = new String(paramValue.getBytes(("iso-8859-1"),"utf-8"))

  (2)修改tomcat的配置文件

      修改%tomcat%/conf/server.xml,加上URIEncoding属性。内容如下:

       <Connector port="8080" protocol="HTTP/1.1"

 

               connectionTimeout="20000"

 

               redirectPort="8443" URIEncoding="utf-8"/>

 

相关文章:

  • 2022-12-23
  • 2021-07-04
  • 2021-06-02
  • 2022-12-23
  • 2021-10-24
  • 2022-01-20
  • 2021-11-26
  • 2021-11-26
猜你喜欢
  • 2021-11-10
  • 2021-08-27
  • 2021-08-12
  • 2021-10-28
  • 2022-12-23
  • 2021-07-02
  • 2021-08-20
相关资源
相似解决方案