0
コントローラが/
、もう1つがフォームを送信しています。フォーム登録後に/
コントローラにリダイレクトします。ここコントローラでRedirectAttributeによって送信されたパラメータを読み取ることができません
は/
のための私のコントローラである:
@RequestMapping(value = "/", method = RequestMethod.GET)
public String mainPage(@RequestParam(value = "registerSuccessful", required = false) boolean registerSuccessful,
ModelMap modelMap) throws UnknownHostException {
boolean isDeviceRegistered = mainService.isDeviceRegistered();
modelMap.addAttribute("isDeviceRegistered", isDeviceRegistered);
modelMap.addAttribute("registerSuccessful", registerSuccessful);
return "main";
}
と/registerForm
用コントローラ:
@RequestMapping(value = "registerForm", method = RequestMethod.POST, produces = "text/plain;charset=UTF-8")
public String saveDeviceInfo(@ModelAttribute("deviceInfo") DeviceInfo deviceInfo,
RedirectAttributes redirectAttributes,
BindingResult result, ModelMap modelMap){
mainService.saveDeviceInfo(deviceInfo);
redirectAttributes.addFlashAttribute("registerSuccessful", true);
return "redirect:/";
}
ご覧の通り、私は/
にregisterSuccessful
の内容を読んだとき、私は属性registerSuccessful
ためtrue
を送るが、リダイレクト後のハンドラはfalseです。
どうすれば修正できますか?このような