※ Jimmy's/web 개발
View 에서 Command 객체 접근하기
JimmyUm
2014. 5. 12. 16:48
* View 코드에서 Controller의 @RequestMapping 어노테이션 메서드에서 전달받은 Command 객체에 접근 가능하다.
ex)
@RequestMapping(method = RequestMethod.POST)
public String submit(NewAaaCommand command){
...
}
Command 객체의 클래스 이름을 이용하여 View 코드에서 Command 객체에 접근할 수 있다.(첫글자는 소문자)
ex)
<body>
...
${newAaaCommand.Bbb}
...
@ModelAttribute 어노테이션을 이용한 방법
@RequestMapping(method = RequestMethod.POST)
public String submit(@ModelAttribute("abcd") NewAaaCommand command){
xxxxx.writeArticle(command);
return "hello";
}
${abcd.aaa}