@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中马上移除对象,所以在刷新一下后这个值就会丢掉。