重定向
controller方法:
@RequestMapping("test1")
public String test1(Model model){
model.addAttribute("data1","test1");
return "index";
}
@RequestMapping("test2")
public String test2(Model model){
model.addAttribute("data2","test2");
return "redirect:test1";
}
在index.jsp界面中,可以接收到data1,但接收不到data2,而是将data2=test2拼接到url后面。
调用
controller方法:
@RequestMapping("test1")
public String test1(Model model){
model.addAttribute("data1","test1");
return "index";
}
@RequestMapping("test2")
public String test2(Model model){
model.addAttribute("data2","test2");
test1(model);
}
在index.jsp界面中,可以同时接收到data1、data2。
最后
以上就是无聊路人最近收集整理的关于SSM的controller中的一个方法跳到另一个方法的两种方式重定向调用的全部内容,更多相关SSM内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复