title: Spring and tag mvc resources, can't reach .css, and .js files
body: <p>My application use Spring 3.0.4(this is first version where tag mvc:resources work fine).
  The current issue is that my app can not reach .css and .js files from the mapped resources.</p>
  
  <p>Structure test.war:</p>
  
  <pre><code>/test -root
     |
     /static-resource
              |
              /css
                 |
                 /screen.css
              |
              /js
     |
     /WEB-INF
     |
     /index.jsp
  </code></pre>
  
  <p>My test-servlet.xml </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:p="http://www.springframework.org/schema/p"
         xmlns:jee="http://www.springframework.org/schema/jee"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:util="http://www.springframework.org/schema/util"
         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.0.xsd
              http://www.springframework.org/schema/context   http://www.springframework.org/schema/context/spring-context-3.0.xsd
              http://www.springframework.org/schema/jee       http://www.springframework.org/schema/jee/spring-jee.xsd
              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
              http://www.springframework.org/schema/aop       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
              http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt;
  
          &lt;mvc:annotation-driven/&gt;
      &lt;mvc:resources mapping="/resources/**" location="/static-resource/"/&gt;
  
      &lt;context:annotation-config/&gt;
      &lt;context:component-scan base-package="org.web"/&gt;
      &lt;tx:annotation-driven/&gt;
  
          &lt;bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"&gt;
              &lt;property name="definitions"&gt;
                  &lt;list&gt;
                      &lt;value&gt;/WEB-INF/tiles-defs.xml&lt;/value&gt;
                  &lt;/list&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
              &lt;property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/&gt;
          &lt;/bean&gt;
  
   &lt;bean id="authenticationInterceptor" class="org.util.AuthenticationInterceptor"/&gt;
  
      &lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
          &lt;property name="basename" value="classpath:messages"/&gt;
          &lt;property name="defaultEncoding" value="UTF-8"/&gt;
          &lt;property name="cacheSeconds" value="-1"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
      &lt;property name="paramName" value="lang" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver"&gt;
          &lt;property name="defaultLocale" value="en"/&gt;
          &lt;property name="cookieName" value="bovalta_language"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt;
      &lt;property name="interceptors"&gt;
          &lt;list&gt;
              &lt;ref bean="authenticationInterceptor"/&gt;
              &lt;ref bean="localeChangeInterceptor"/&gt;
         &lt;/list&gt;
     &lt;/property&gt;
      &lt;/bean&gt;
  
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>In the index.jsp I try access to the resources on two ways with spring url and with JSTL url like below </p>
  
  <pre><code>&lt;%-- With JSTL url --%&gt;
  &lt;link media="screen" rel="stylesheet" href="&lt;c:url value="/resources/css/screen.css"/&gt;" type="text/css"/&gt;
  &lt;%-- With Spring url --%&gt;
  &lt;spring:url value="/resources" var="resourceUrl"/&gt;
  &lt;link media="screen" rel="stylesheet" href="${resourceUrl}/css/screen.css" type="text/css" /&gt;
  </code></pre>
  
  <p>When I undeploy war file in the Tomcat AS, application work fine without any exception, but Tomcat server can not find my css and js files from resources.
  I try to reach css file through url <a href="http://localhost:8080/test/resources/css/screen.css" rel="nofollow">http://localhost:8080/test/resources/css/screen.css</a>
  but Tomcat not found it. Any suggestion will be useful. </p>
  
  <p>Thanks in advance</p>