풀스택/Spring

spring html, css적용 안될때

woohyun22 2019. 2. 23. 20:11

https://github.com/jeongwoohyunn/mysite3-spring-


spring에서 css,html,js에 파일 접근에 실패할때


이유는 DispatchServlet이 모든 URL처리에서 매핑을 하여서 DefaultServlet에 위임을 하지 못하기 때문에



spring -servlet.xml 파일에서

<!-- 서블릿 컨테이너의 디폴트 서블릿 위임 핸들러 

<mvc:default-servlet-handler/> 


를 추가해줘야된다. - 그냥 css,html파일 적용안될때는 그냥 이걸 넣어주면된다.


<!-- validator, conversionService, messageConverter를 자동으로 등록 -->

<mvc:annotation-driven />


이런것두 있댄다. 그냥 같이 넣어주면 좋을듯.






728x90