利用 redirectAttributes 为重定向后的页面传参,但是在最终的showcustomer.jsp中取不到message的值,怎么办?
ps:由于jsp文件都在WEB-INF/jsp下面,所以不能直接重定向到jsp页面,必须经过中间那步showcustomer的请求
@RequestMapping(value="addcustomer", method=RequestMethod.POST)
public String addCustomer(String customer,RedirectAttributes redirectAttributes) {
redirectAttributes.addFlashAttribute("message","Added successfully.");
return "redirect:showcustomer";
}
@RequestMapping(value="showcustomer", method=RequestMethod.GET)
public ModelAndView addCustomer() {
ModelAndView mv = new ModelAndView ();
mv.setViewName("customer/showcustomer");
return mv;
}
--
FROM 1.202.152.*