特牛网址导航

SpringBoot中RedirectAttributes重定向传递对象解决办法-CSDN博客

网友收藏
文章浏览阅读2.1k次,点赞6次,收藏3次。SpringBoot两个Controller重定向传参解决办法​ 这是我昨天遇到的一个问题,Controller中想要传递参数时,比较常用的是Model,但是如果Controller返回采用重定向的方法,model中的数据则不能成功带到重定向的页面中去。​ 在网上查阅一些资料后,发现可以用RedirectAttributes。具体代码如下:Controller1@RequestMapping("/testA") public String A(RedirectAttributes redir_redirectattributes