java後臺重定向post傳參及接受重定向post傳參

項目中碰到的問題是,我在controller中有重定向傳參到另一個controller,可是接收到的值是亂碼    ps:我傳的參數是漢字app

請教了咱們的項目經理,說是那個重定向傳參是get方式的請求傳參:示例代碼post

return "redirect:/RepaieInfo/goDetail?companyId="+companyId
                        +"&baseNo="+baseNo
                        +"&doorId="+doorId
                        +"&account="+creater
                        +"&id="+idRepair
                        +"&modifier="+modifier
                        +"&workOrderStatus="+"1";

後面我改爲了post傳參: 這個是重定向post傳參;spa

public String add(Map<String, Object> map, RedirectAttributes attributes,
//將有漢字得參數,以post的方式傳過去
attributes.addFlashAttribute("descContentV",descContentV);

第二個controller 是要接受我第一個controller傳過來的參數code

@RequestMapping(value = "/goDetail")
    public String goDetail(HttpServletRequest httpRequest,
            @ModelAttribute("descContentV") String descContentV, //接收第一個controller重定向傳過來的參數(post)
            ModelMap model){

後續在進行正常的邏輯blog

相關文章
相關標籤/搜索