1. 使用 redirect 进行页面跳转时参数的传递
★ 使用的API: RedirectAttributes , Model 的加强子接口
public interface RedirectAttributes extends Model
★ 方法 :
RedirectAttribute addFlashAttribute () ; //直接就可以在跳转的页面用 el 表达式获取
RedirectAttribute addAttribute() ; // 会在跳转的链接尾端拼 参数
★ i . e :
//controller 中 方法
@RequestMapping(value = "/accounts",method = RequestMethod.POST)
public String handle(Account account, RedirectAttributes redirectAttributes){
redirectAttributes.addAttribute("id",account.getId).addFlashAttribute("message", "Account created!");
return "redirect:/accounts/{id}";
}