title: Spring 3.1: Getting the <mvc:resources To Work
body: <p>I'm new to Spring.  I'm learning Spring 3.1.   I'm using the book "Spring In Action, 3rd ed..  I'm having trouble getting static resources found.  The book doesn't say much about it so I was wondering if I could get some help.</p>
  
  <ul>
  <li>The name of my application is "abc"</li>
  <li>The URL is something like "https://blah.blah.blah/abc</li>
  <li>I'm running "abc" on <strong>WebLogic 9.2</strong></li>
  <li>I'm deploying "abc" as "abc.war"</li>
  </ul>
  
  <p>The directory structure inside of my "abc.war" is</p>
  
  <pre><code>WEB-INF 
     classes
     lib
     web.xml
     webLogic.xml
     abc-servlet.xml
  css
  images
  js
  jsp
  META-INF
  </code></pre>
  
  <p>In my web.xml  I have my dispatcher servlet defined like this:</p>
  
  <pre><code> &lt;servlet&gt;
      &lt;servlet-name&gt;abc&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;abc&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>.....and this is the content of my abc-servlet.xml file:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc
          http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
          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"&gt;
  
    &lt;context:component-scan base-package="org.company.abc.controllers" /&gt;
  
    &lt;mvc:resources mapping = "/**" location = "/"/&gt;
    &lt;mvc:annotation-driven/&gt;
  
    &lt;bean
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name = "prefix" value = "/jsp/"/&gt;
      &lt;property name = "suffix" value = ".jsp"/&gt;
    &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>I've tried putting my static resources under a "resources" directory off of the root of my webapp, but that didn't make any difference ( I changed the tag to <code>&lt;mvc:resources mapping = "/resources/**" location = "/resources"/&gt;</code> when I did that ).</p>
  
  <p>Basically, the abc webapp isn't finding any of the static resources.</p>
  
  <p>It thinks the picture "header.png" is at</p>
  
  <pre><code>- htts://blah.blah.blah/images/header.png
  </code></pre>
  
  <p>So the image comes up blank, though when I paste this URL into a browser, I can get the image</p>
  
  <pre><code>- htts://blah.blah.blah/**abc**/images/header.png
  </code></pre>
  
  <p>I haven't found a way to get Spring to stick a "abc" into that url though.</p>
  
  <p>I'm a brand new white belt with Spring, so baby talk in helping me figure this out with suggestions will not be taken as an insult :)</p>
  
  <p>Thanks in advance for any help</p>
  
  <p>Steve</p>