지난 글에는 클라이언트에서 html form 값을 서버로 전송하였다면 이번 포스팅에는 서버값을
웹페이지로 넘겨보도록 하겠음.
지난시간과 마찬가지로 HelloWorld 클래스에 컨트롤러를 추가로 해보도록하겠다.
@RequestMapping("/response")
public String response(Model model){
model.addAttribute("value1", "값넘기기1");
model.addAttribute("value2", "값넘기기2");
return "response";
}
이어서 response.jsp 파일을 view 디렉토리에 생성하도록 하고 body 태그내에
다음과 같이 작성해주자
값 1 : ${value1 }
<br/>
값 2 : ${value2 }
서버 컨트롤러에서 model객체를 이용하여 addAttribute를 해주었는데 value1/value2라는 key값을
이용하여 jsp 페이지에 EL태그를 사용하면 다음과 같이 화면에 key값의 value가 출력되는것을
확인할 수 있을것이다.

잘 나오는고만~~ 
지금까지 request /response에 대하여 알아보았다.



도움이 되셨다면 공감클릭! 궁금하신점은 댓글!!