码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMVC中redirect跳转后如何保存Model中的数据?

时间:2017-08-03 23:44:20      阅读:350      评论:0      收藏:0      [点我收藏+]

标签:rect   方式   line   direct   pos   如何   model   就会   sha   

@RequestMapping(value = "delete-user", method = RequestMethod.POST)

public String deleteUser(Long[] userId, RedirectAttributes modelMap) {

  userService.deleteUser(userId);

  modelMap.addFlashAttribute("resultMsg", "删除成功");

  return "redirect:list-user.shtml";

}

这种方式从spring3.1开始支持,原理是:

把属性放到session中,在跳到页面后又在session中马上移除对象,所以在刷新一下后这个值就会丢掉。

SpringMVC中redirect跳转后如何保存Model中的数据?

标签:rect   方式   line   direct   pos   如何   model   就会   sha   

原文地址:http://www.cnblogs.com/itxinke/p/7282638.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!