重定向
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。