Spring servlet-context.xml vs root-context.xml
DTD 업그레이드 ⇒ xsd
위의 사진은 servlet-context.xml
아래는 root-context.xml이다
즉, xsd가 여러 개 또는 한 개라는 차이가 prefix의 사용여부를 결정 짓는다
servlet-context.xml은 구분을 위해 prefix를 사용한다
<beans:beans ......
root-context.xml은
<beans ...
※ prefix
xmlns(xml namespace) 여러개가 들어가 있다는 의미 (충돌회피를 위해 이름을 통해 구별한다!!)
xmlns:mvc ="http://www.springframework.org/schema/mvc"
mvc prefix로 받겠다
xmlns="http://www.springframework.org/schema/mvc"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
servlet-context.xml에는 세 개의 xsd가 있는데 모두 prefix 해줄 필요 없다. 하나만 prefix 안 해 줄 수 있는데 prefix 없이 바로 컨트롤+스페이스 해주면 사용할 수 있다.
<beans:beans ...> 태그에 beans prefix를 안 쓰고 싶다면 mvc에 prefix 주고 beans에는 생략해주면
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
=> <beans> 로 바꾸어 줄 수 있다.
'Spring' 카테고리의 다른 글
Spring 8월 27일 Mission_ 문제1 (0) | 2018.08.27 |
---|---|
Spring 8월 27일 Mission (0) | 2018.08.27 |
Spring 시작 전 개념 익히기2----- (0) | 2018.08.23 |
"그림으로 알아보는 Get&Post" (0) | 2018.08.23 |
"Spring URL 요청에 Model 없이 JSP 전달이 가능한가??" (0) | 2018.08.23 |