I am trying to set up RedirectAttributes
, but nothing happens when I do so. Here is my controller:
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@GetMapping("/run-1")
public String getTests(RedirectAttributes redirectAttributes) {
logger.info("Info Log in Main controller class");
logger.info(workingDir);
redirectAttributes.addFlashAttribute("uploadStatus", "redirectWithRedirectView");
redirectAttributes.addAttribute("uploadStatus", "redirectWithRedirectView");
return "redirect:uploadStatus";
}
This is a SpringBoot project, and since it is the Umbrella over Spring MVC, then I assumed I could use RedirectAttributes
. So, what is going on? When I hit this end point, I am returned: redirect:uploadStatus
CodePudding user response:
@RequestMapping(value = "/session", method = RequestMethod.POST)
public String joinSession(RedirectAttributes redirectAttributes){
/* --- */
redirectAttributes.addFlashAttribute("error", "!!!Wrong Password!!!");
return "redirect:/dashboard";
}