Ja chce używać RedirectAttibutes właściwość, która ma pochodzić wiosną 3.1, mam następującą metodę obsługi dla odpowiedzieć w moim kontrolerRedirectAttributes dając IllegalStateException wiosną 3,1
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String register(@ModelAttribute("admin") Admin admin, BindingResult bindingResult, SessionStatus sessionStatus, RedirectAttributes redirectAttributes) {
redirectAttributes.addAttribute("admin", admin);
if (bindingResult.hasErrors()) {
return REGISTRATION_VIEW;
}
sessionStatus.setComplete();
return "redirect:list";
}
Ale kiedy złożyć formularz I otrzymuję następujący wyjątek:
java.lang.IllegalStateException: Argument [RedirectAttributes] is of type Model or Map but is not assignable from the actual model. You may need to switch newer MVC infrastructure classes to use this argument.
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:322)
mam natknąć kilka gotcha jest z redirectAttributes że nie można używać ModelAndView jako typ zwracany. Więc zwróciłem tylko widok łańcucha.
Czy ktoś może pl. powiedz mi, gdzie idę źle?
Dzięki.
Dodanie polecenia rozwiązało problem !!! Dzięki. –
tintin
@EnableWebMvc dla kontrolera rozwiązał problem. Gdzie powinien być dodany "mvc: adnotacja sterowana"? –