springmvc ModelAndView 和 Model

 @RequestMapping("")
public ModelAndView index(HttpSession session) {
Object data = session.getAttribute("user");
ModelAndView view = new ModelAndView("main/index");
view.addObject("message", "验证失败,正在跳转中...");
if (data != null) {
return view;
} else {
return view;
}
}
  @RequestMapping(value = "test", method = RequestMethod.GET)
public String test(Model model) {
model.addAttribute("parametername", "handsome");
return "test";
}
上一篇:mysqldump详解


下一篇:#Java学习之路——基础阶段二(第九篇)