URL重定向传参
后端在进行重定向时,传统的ModelMap已经不能传参了,必须使用RedirectAttributes代替。
后台使用RedirectAttributes的addFlashAttribute()方法来添加参数,这种方式不会将参数暴露在重定向URL中,参数可以在重定向的界面中通过EL表达式获取。
//重定向的Controller
@RequestMapping("/redirect")
public String home(String url, RedirectAttributes attributes){
String url = "https://www.baidu.com"