Imは現在、spring mvc、java、注釈を使用しています。リダイレクトビューからオブジェクトを取得する方法は?
@RequestMapping(value = "/submitTask", method = RequestMethod.POST)
public ModelAndView submitTask(HttpSession session, HttpServletRequest request) {
Map<String, Object> map = new HashMap<String, Object>();
ModelAndView model = new ModelAndView(new RedirectView("home.html"));
map.put("email", request.getParameter("email"));
map.put("task",request.getParameter("task"));
map.put("error", request.getParameter("error"));
model.addObject("map", map);
return model;
}
@RequestMapping("/home")
public ModelAndView home(HttpSession session, HttpServletRequest request) {
ModelAndView model = new ModelAndView("home");
model.addObject("map", request.getParameter("map"));
return model;
}
私はhome.htmlに私の見解をリダイレクトするとき、私は「request.getParameter(」マップ「)」を介して「マップ」の値を取得していないようです。どのように私はそれを取得することができます。ありがとう
submitTaskメソッドでは、セッションにオブジェクトを設定するのを忘れたと思います。 session.setAttribute( "map"、map); –
これは不完全な質問です。どのようにリクエストしているか教えてください。 URLとは何ですか?そしてそのようなもの。 –
imはsubmitTask.htmlにありますので、submitTaskメソッド – randy