// 跳向下一action地址(带多个参数, 刷新后被清空), go-to @RequestMapping("/goto") public String go_to(RedirectAttributesModelMap model) { UserLoginBean user = new UserLoginBean(); user.setUsername("中文名"); user.setPassword("password"); // 导入map model.addFlashAttribute("user", user); model.addFlashAttribute("message", "消息"); logger.info(model.getFlashAttributes().get("message").toString()); return "redirect:/from"; }
@RequestMapping(value = CATEGORY_CREATE_URL, method = RequestMethod.POST) public String createCategory( Category category, final RedirectAttributesModelMap redirectAttributesModelMap) { categoryService.save(category); redirectAttributesModelMap.addFlashAttribute(MSG_ATTRIBUTE, SUCCESS_CREATE_CATEGORY); return REDIRECT_CREATE_QUESTION_URL; }