• java后台重定向post传参及接受重定向post传参


    项目中碰到的问题是,我在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){

    后续在进行正常的逻辑

  • 相关阅读:
    net过滤表单和url参数
    html mailto
    sql提取汉字拼音首字母
    使用jquery获取radio的值
    net文件服务器配置
    如何将简体字保存到繁体数据库而不会出现乱码
    net直接下载文件
    java开发:笔记
    android开发:LogCat失效,adb失效
    编程记事本
  • 原文地址:https://www.cnblogs.com/wumingxuanji/p/9041639.html
Copyright © 2020-2023  润新知