[Spring MVC]ModelAndViewと@RequestParamのサンプル
Javaコード
@RequestMapping(value="/create",method = RequestMethod.POST) public ModelAndView create(@RequestParam("username") String username){ ModelAndView modelAndView = new ModelAndView("userMsg"); modelAndView.addObject("username","値: "+ username); modelAndView.addObject("addr","test address"); return modelAndView; }
JSPコード
<form method="post" action="/user/create" <input type="text" name="username" <input type="submit"