简要笔记:由于jsp默认表单提交编码方式是:ISO-8859-1,而我们需要的是utf-8或者是gbk码,故需要转化。

具体方法是:在表单处理文件中,将获取到的变量进行转换。

          String userName = request.getParameter("userName");  
                String password = request.getParameter("password");  
                out.println("表单输入userName的值:" + new String(userName.getBytes("ISO-8859-1"), "gb2312")+ "<br>");  
                out.println("表单输入password的值:" + new String(password.getBytes("ISO-8859-1"), "gb2312")+ "<br>");  

  

相关文章:

  • 2021-11-30
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2021-05-10
  • 2022-01-16
猜你喜欢
  • 2021-09-19
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2021-11-23
  • 2021-07-05
  • 2021-07-20
相关资源
相似解决方案