Redirecting携带数据
来源:互联网 发布:神机妙算软件介绍 编辑:程序博客网 时间:2024/04/28 00:36
通常我们在重定向一个url时,是无法把model携带上的,如
那么有两种方法:
Redirecting with URL templates
Working with flash attributes
来解决这个问题
1.
@RequestMapping(value="/register", method=POST)public String processRegistration(Spitter spitter, RedirectAttributes model) {spitterRepository.save(spitter);model.addAttribute("username", spitter.getUsername());model.addFlashAttribute("spitter", spitter);return "redirect:/spitter/{username}";}工作原理
为了防止数据意外丢失
@RequestMapping(value="/{username}", method=GET)public String showSpitterProfile(@PathVariable String username, Model model) {if (!model.containsAttribute("spitter")) {model.addAttribute(spitterRepository.findByUsername(username));}return "profile";}
0 0
- Redirecting携带数据
- 跳转Activity携带数据
- Intent携带数据切换Activity
- 携带cookie进行数据请求
- 36.activity返回携带数据
- activity跳转时携带数据:
- Notification中Intent携带数据重复问题
- Notification中Intent携带数据重复问题
- Neutron的context携带哪些数据
- Intent携带额外的数据的方法
- Intent携带额外的数据的方法
- Android--Activity在跳转时携带数据
- 网上请求数据以及跳转携带对象
- intent携带数据的集中方式
- 启动其他程序Intent携带的数据
- android-页面跳转及携带数据
- 34.activity携带数据显示跳转
- Bundle传输数据之携带集合对象
- caffe架构学习之(一)--基于google protocol buffer开源项目的深度网络定义
- 第四周 项目一-三角形类的构造函数(二)
- 山寨免费软件的阴谋!
- 终于找到了-----------让工资再涨的编程方式
- 将ppt文件如何转换成pdf文件
- Redirecting携带数据
- 优化实例内存
- Android Studio 1.1.0 配置androidannotations框架
- POJ - 1521 Entropy
- android获取在线视频略缩图
- Discover Feature Engineering, How to Engineer Features and How to Get Good at It
- mysql命令行修改字符编码
- C++中vector用法
- PHP5.6新特性介绍