1:addFlashAttribute
2:addAttribute
@RequestMapping
(value=
"hello"
)
public
String test(RedirectAttributes ra){
ra.addFlashAttribute(
"test"
,
"test"
);
return
"redirect:/hello"
;
}
@RequestMapping
(value=
"test"
)
public
String test(
@ModelAttribute
(
"test"
) String test){
System.out.println(test);
return
"redirect:/hello"
;
}
2:addAttribute
@RequestMapping(value="hello")
public String test(RedirectAttributes ra){
ra.addAttribute("test", "test");
return "redirect:/hello";
}
@RequestMapping(value="test")
public String test(HttpServletRequest request
/* ①:@ModelAttribute("test") String test*/
/*②:@RequestParam("test") String test*/){
/*③:*/String test = request.getParameter("test");
System.out.println(test);
return "redirect:/hello";
}
public String test(RedirectAttributes ra){
ra.addAttribute("test", "test");
return "redirect:/hello";
}
@RequestMapping(value="test")
public String test(HttpServletRequest request
/* ①:@ModelAttribute("test") String test*/
/*②:@RequestParam("test") String test*/){
/*③:*/String test = request.getParameter("test");
System.out.println(test);
return "redirect:/hello";
}