springmvc ModelAndView 및 Model
1551 단어 ModelAndView
@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";
}