@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"; }