[Spring MVC]ModelAndViewクラスのサンプル

書式
new ModelAndView(xxxx)
使用例

@Controller
public class UserController {

  @RequestMapping(value="/create",method = RequestMethod.GET)
  public ModelAndView create(){
        ModelAndView modelAndView = new ModelAndView("userMsg");
      modelAndView.addObject("username","test user name");
      modelAndView.addObject("addr","test address");
      return modelAndView;
  }
}

 

SpringMVC

Posted by arkgame