控制器中的彈簧重定向不起作用,如返回「重定向:/ reservation/reservationSuccess」但返回「/ reservation/reservationSuccess」;工作中。爲什麼它不工作。它出錯了。請幫忙。彈簧重定向不起作用
@RequestMapping(method = RequestMethod.POST)
public String submitForm(@ModelAttribute("reservation") Reservation reservation,
BindingResult result,
SessionStatus status,
Model model) {
validator.validate(reservation, result);
if(result.hasErrors()) {
model.addAttribute("reservation",reservation);
return "reservation/reservationForm";
}
reservationService.make(reservation);
status.setComplete();
return "redirect:reservation/reservationSuccess";
}
定義「不工作」。你期望它做什麼,它做什麼呢? – 2012-02-26 08:12:29
它給404或找不到錯誤消息。我希望呈現reservationSuccess視圖。但/ reservation/reservationSuccess正在呈現reservationSuccess.jsp頁面。 – Curious 2012-02-26 11:27:39