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);

posted on 2012-12-17 13:44  双耳  阅读(3324)  评论(0编辑  收藏  举报

导航