我们都知道,一般情况下使用post请求是不会出现中文乱码的。可是在使用httpclient发送post请求报文含中文的时候在发送端数据正常但是到了服务器端就中文乱码了。

编码URLEncoder.encode(depmsOrg,"utf-8");

解码URLDecoder.decode(depmsOrg, "utf-8");

 

@RequestMapping("/adjustProgressListView")
        public String adjustProgressListView(HttpServletRequest request){
            TotAdjustProgress beanAdjust = new TotAdjustProgress();
            try {
                HashMap<String, String> paramMap = new HashMap<String, String>();
                //权限控制
                String depmsOrg = (String) request.getSession().getAttribute("depmsOrg");
                if(depmsOrg!=null&& !depmsOrg.equals("")){
                    paramMap.put("districtBy", URLEncoder.encode(depmsOrg,"utf-8"));
                }
                String jsonResult = HttpClientUtil.sendPost(chainplanmanger_url+"/getServiceStationAdjustProgress.do", paramMap);
                if(StringUtil.isNotEmptyAndNotNull(jsonResult)){
                    beanAdjust = JSON.parseObject(jsonResult, TotAdjustProgress.class);
                }
                request.setAttribute("beanAdjust", beanAdjust);
            } catch (Exception e) {
                logger.error("AdjustProgressListController::adjustProgressListController::", e);
            }
            return "adjust/adjustProgressListView.ftl";
        }

 

相关文章:

  • 2022-01-20
  • 2021-07-06
  • 2021-12-21
  • 2022-01-16
  • 2021-06-02
  • 2021-10-28
  • 2022-01-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2021-08-14
  • 2021-12-21
  • 2022-12-23
  • 2021-06-04
相关资源
相似解决方案