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);
  • 相关阅读:
    13点睛Spring4.1-Spring EL
    12点睛Spring4.1-Spring Aware
    11点睛Spring4.1-Property Editor
    10点睛Spring4.1-Application Event
    09点睛Spring4.1-AOP
    08点睛Spring4.1-Profile
    07点睛Spring4.1-BeanPostProcessor
    06点睛Spring4.1-Bean的初始化和销毁
    05点睛Spring4.1-国际化
    Solaris 11 配置IP地址
  • 原文地址:https://www.cnblogs.com/shuanger/p/2821578.html
Copyright © 2011-2022 走看看