項目中碰到的問題是,我在controller中有重定向傳參到另外一個controller,但是接收到的值是亂碼 ps:我傳的參數是漢字
請教了我們的項目經理,說是那個重定向傳參是get方式的請求傳參:示例代碼
return "redirect:/RepaieInfo/goDetail?companyId="+companyId +"&baseNo="+baseNo +"&doorId="+doorId +"&account="+creater +"&id="+idRepair +"&modifier="+modifier +"&workOrderStatus="+"1";
后面我改成了post傳參: 這個是重定向post傳參;
public String add(Map<String, Object> map, RedirectAttributes attributes, //將有漢字得參數,以post的方式傳過去 attributes.addFlashAttribute("descContentV",descContentV);
第二個controller 是要接受我第一個controller傳過來的參數
@RequestMapping(value = "/goDetail") public String goDetail(HttpServletRequest httpRequest, @ModelAttribute("descContentV") String descContentV, //接收第一個controller重定向傳過來的參數(post) ModelMap model){
后續在進行正常的邏輯