02스프링프론트컨트롤러작성
스프링 프론트 컨트롤러 작성하기
그렇다면 매핑 파일을 만들어 보자!
1.-servelt.xml 파일 만들기 스프링이 제공하는 dispatcher는 url을 -servelt.xml 로 담아 놓는다
2.https://docs.spring.io/spring-framework/docs/에서 스프링 프레임워크와 맞는 것을 검색하여 가져오기
3.약속이 필요하다 : 함수명 약속을 가지고 있는 handlerequest 만들기(인터페이스)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="/index" class="com.newleture.web.controller.IndexController">
<!--id는 클래스에 담긴 것을 담는다 -->
</bean>
</bean>
</beans>
url과 controller를 맵핑하는 작업을 id를 이용해서 url을 쓰게 된다
dispathcher는 스프링이 제공하고 있으며 forwarding을 하여 모델과 뷰를 jsp에게 준다
댓글남기기