문제는 일반적이며 많은 해결책을 시도했지만 나에게 맞는 것은 없습니다. 나는 봄에 아주 새로운데, 그래서 나는 어떤 것을 이해하지 못할 수도있다.Java Spring-MVC 애플리케이션이 CSS 및 JS 파일을 보내지 않습니다. 오류 404
나는 다음 파일 구조를 가지고 : 페이지 내부
내 링크가이 같은 Thymeleaf에 의해 템플릿된다
<link rel="stylesheet" th:href="@{css/bootstrap.css}" type="text/css"/>
또한, HTML의 머리에 속성이있다.
좋아, 내 스프링의 context.xml은 다음과 같습니다
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!--to pick up all annotation in the package-->
<context:component-scan base-package="langquiz"/>
<mvc:annotation-driven />
<mvc:resources mapping="/css/**" location="/css/"/>
</beans>
나는 ("/ 템플릿/CSS /"또는 위치 = "CSS /"= 위치를 쓰는 같은) 매핑에 몇 가지 조작을 시도했습니다 또한 구성 클래스에서 자원 처리기를 시도했습니다. 그러나 아무것도 도움이되지 않습니다.
감사합니다.
는 UPD : 는
<mvc:resources mapping="/css/**" location="/templates/"/>
에
<mvc:resources mapping="/css/**" location="/css/"/>
을 변경하고 또한
<mvc:resources mapping="/css/**" location="/"/>
을 시도했지만 여전히 결과가 없습니다.
에 웹 사이트를 볼 수있는 방법이 있는지
아직도 궁금해? – chrylis@chrylis 예, Spring-MVC + ThymeLeaf입니다. – utkillr