2
どちらが良いですか、spring3コントローラーで「ModelAndView」または「String」を返します
返却方法ModelAndView @RequestMapping(value = "/list", method = RequestMethod.GET) public ModelAndView list( @UserAuth UserAuth user, ModelAndView mav) { if (!user.isAuthenticated()) { mav.setViewName("redirect:http://www.test.com/login.jsp"); return mav; } mav.setViewName("list"); mav.addObject("articles", listService.getLists()); return mav; } 文字列を返す方法 @RequestMapping(value = "/list", method = RequestMethod.GET) public String list( @UserAuth UserAuth user, Model model) { if (!user.isAuthenticated()) { return "redirect:http://www.test.com/login.jsp"; …
115
spring-mvc
controller