zoukankan      html  css  js  c++  java
  • response sendRedirect 带中文乱码,解决方法

    response 使用sendRedirect 带中文跳转:

       1:  String path = request.getContextPath();
       2:                  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
       3:                  try {
       4:                      response.sendRedirect(basePath+"system/error_forward1?forward_url='produce/mrp?list'&error_info="
       5:                          +URLEncoder.encode("已审核不能修改","utf-8"));
       6:                  } catch (IOException e) {
       7:                      e.printStackTrace();
       8:                  }

    system/error_forward1路径处理:

       1:          String error_info = request.getParameter("error_info");
       2:          String forward_url = request.getParameter("forward_url");
       3:          
       4:          model.addAttribute("error_info", new String(error_info.getBytes("ISO8859_1"),"utf-8"));
       5:          model.addAttribute("forward_url", forward_url);
  • 相关阅读:
    神代码
    初读《代码大全》
    单词频度统计
    AFO
    bzoj4816: [Sdoi2017]数字表格
    bzoj4006: [JLOI2015]管道连接
    bzoj4774: 修路
    bzoj3209: 花神的数论题
    bzoj4521: [Cqoi2016]手机号码
    COGS2314. [HZOI 2015] Persistable Editor
  • 原文地址:https://www.cnblogs.com/shuanger/p/2821578.html
Copyright © 2011-2022 走看看