我有一个Spring MVC项目(AppFuse),并且Flash属性未传输到GET请求。
我的工作:在发射器方法中:
@RequestMapping(method = RequestMethod.POST)
public String onSubmit(Entity entity, BindingResult errors, HttpServletRequest request, HttpServletResponse response, RedirectAttributes ra){
...
ra.addFlashAttribute("id", entity.getId().toString());
success = "redirect:somePage";
...
return success;
}
在接收器方法中,我无法获取传递的flash属性。我尝试了以下方法:
问题出在重定向字符串中。工作之一是:
success = "redirect:/somePage";
更正确的解决方案是:
success = "redirect:" + request.getContextPath() + "/somePage";
双斜杠重定向也不起作用:
success = "redirect://somePage";
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句