关于RedirectAttributes 重定向带参数请求问题


    @RequestMapping("/delete")
    public String delete(String id, RedirectAttributes redirectAttributes) {
           redirectAttributes.addFlashAttribute("msg","删除成功!");
           return "redirect:index";
    }
    @RequestMapping({"", "/", "/index"})
    public String index( @ModelAttribute("msg") String msg) {
		        logger.info("index()   msg   " + msg);
		        return "bus/busserviceprovider/busServiceProviderIndex";
    }

在Index 方法中使用@RequestParam:注解不能获取到重定向传递过来的参数,使用@ModelAttribute可以获取数据。

原文地址:https://www.cnblogs.com/shaofeer/p/11154324.html