通常在Spring MVC的控制器中往页面传值会采用
model.addAttribute("user":user);
但是如果控制器需要重定向到该页面,则会出现前端页面取不到值的情况,采用
redirectAttributes.addFlashAttribute("tpUser", tpUser);
可以成功传递。
通常在Spring MVC的控制器中往页面传值会采用
model.addAttribute("user":user);
但是如果控制器需要重定向到该页面,则会出现前端页面取不到值的情况,采用
redirectAttributes.addFlashAttribute("tpUser", tpUser);
可以成功传递。
转载于:https://www.cnblogs.com/huangzh1996/p/7270359.html