分两种情况:

1.获取访问请求参数时乱码

解决方法:构造一个新的String

String user = new String(request.getParameter("user").getBytes("iso-8859-1"),"UTF-8");

2.获取表单提交的信息乱码

解决方法:在page指令下方加上(一定要在页面中没有调用任何request对象的方法之前写):

<% request.setCharacterEncoding("UTF-8");%>

相关文章:

  • 2021-12-29
  • 2021-10-31
  • 2022-12-23
  • 2021-05-06
  • 2021-06-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
猜你喜欢
  • 2021-07-14
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2022-01-24
  • 2021-07-06
  • 2022-12-23
相关资源
相似解决方案