2013-03-28 3 views
1

Spring과 정적 리소스를 매핑 할 때 문제가 있습니다. 404 오류가 발생합니다.Spring 3 Thymeleaf로 정적 리소스 매핑

<link rel="stylesheet" type="text/css" href="../oldcss/reset.css" th:href="@{/oldcss/reset.css}"/> 
    <link rel="stylesheet" type="text/css" href="../oldcss/skeleton.css" th:href="@{/oldcss/skeleton.css}"/> 
    <link rel="stylesheet" type="text/css" href="../oldcss/style.css" th:href="@{/oldcss/style.css}"/> 
    <!-- Import JS --> 
    <script src="../oldjs/jquery.min.js" th:src="@{/oldjs/jquery.min.js}"></script> 
    <script src="../oldjs/responsiveslides.min.js" th:src="@{/oldjs/responsiveslides.min.js}"></script> 

사람이 나에게 가능한 문제를 찾을 수 있습니다 - 내 서블릿 코드는 내가 같은 정적 객체를 참조하고

<?xml version="1.0" encoding="UTF-8"?> 
<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-3.1.xsd 
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd 
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> 

<context:component-scan base-package="web.controller" /> 

<!-- Enabling Spring MVC configuration through annotations --> 
<mvc:annotation-driven /> 

<!-- Mapping Static Resources --> 
<mvc:resources mapping="/css/**" location="/resources/css/" /> 
<mvc:resources mapping="/js/**" location="/resources/js/" /> 
<mvc:resources mapping="/images/**" location="/resources/images/" /> 
<mvc:resources mapping="/oldcss/**" location="/resources/oldResources/css/" /> 
<mvc:resources mapping="/oldjs/**" location="/resources/oldResources/js/" /> 
<mvc:resources mapping="/oldimages/**" location="/resources/oldResources/images/" /> 


<bean id="templateResolver" 
    class="org.thymeleaf.templateresolver.ServletContextTemplateResolver"> 
    <property name="prefix" value="/WEB-INF/views/" /> 
    <property name="suffix" value=".html" /> 
    <property name="templateMode" value="HTML5" /> 
</bean> 

<bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine"> 
    <property name="templateResolver" ref="templateResolver" /> 
</bean> 

<bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver"> 
    <property name="templateEngine" ref="templateEngine" /> 
    <property name="order" value="1" /> 
</bean> 

다음과 같이인가? 사전 :이 문제를 해결

+0

에 서블릿의 매핑을 변경했다 : http://stackoverflow.com/questions/14659142/spring-mvc-with-thymeleaf-update-static-data? rq = 1 –

+0

캐싱을 해제하려고 시도 했습니까? – user1755645

답변

2

... 감사 당신은 대답이 참조 할 수

<mvc:resources mapping="/css/**" location="/WEB-INF/resources/css/" />