Spring
Spring MVC 프로젝트 예제
carrot62
2020. 8. 11. 00:16
MVC framework이란?
Model-view-controller의 약자로 UI 기반 어플리케이션을 디자인 할 때 사용하는 패턴이다. Model, view, controller를 구분해서 동작하도록 한다. The core idea of the MVC pattern is to separate business logic from UIs to allow them to change independently without affecting each other.
Dispatcher Servlet (Spring Controller)
Dispatcher Servlet implements front controller design pattern and every web request must go through it so that it can manage the entire request life cycle.
Spring 3.0에서 controller class를 선언하려면 @Controller annotation을 사용해야 한다.
Handler method를 지정하기 위해서는 @RequestMapping annotation을 사용한다.
본격적으로 Spring MVC 패턴을 사용한 프로젝트를 만들어보자!
- pom.xml : jsp 파일을 작성할 때 필요한 spring mvc와 taglib support dependencies를 가지고 있는 파일이다.
- web.xml: 요청을 처리할 하나의 servlet(dispatcher servlet)을 선언한다.